Click here to Skip to main content
15,881,744 members
Articles / Desktop Programming / WPF

Conceptual Children: A powerful new concept in WPF

Rate me:
Please Sign up or sign in to vote.
5.00/5 (34 votes)
6 Apr 2008BSD32 min read 218.1K   3.2K   122  
This article describes a new approach by which an element can remove its visual and logical relationships to its children while maintaining a conceptual parental relationship with those children.
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Xml;

namespace WpfDiscipleBlogViewer3D
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        Panel3D _panel3D;
        readonly TimeSpan ANIMATION_LENGTH = TimeSpan.FromSeconds(.7);

        public Window1()
        {
            InitializeComponent();
        }

        void OnPanel3DLoaded(object sender, RoutedEventArgs e)
        {
            // Grab a reference to the Panel3D when it loads.
            _panel3D = sender as Panel3D;
        }

        void Open_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        void Open_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            string url = (e.Parameter as XmlAttribute).Value;
            Process.Start(url);
        }

        void MoveForwardButtonClicked(object sender, RoutedEventArgs e)
        {
            _panel3D.MoveItems(1, true, ANIMATION_LENGTH);
        }

        void MoveBackButtonClicked(object sender, RoutedEventArgs e)
        {
            _panel3D.MoveItems(1, false, ANIMATION_LENGTH);
        }

        void PageForwardButtonClicked(object sender, RoutedEventArgs e)
        {
            _panel3D.MoveItems(3, true, ANIMATION_LENGTH);
        }

        void PageBackButtonClicked(object sender, RoutedEventArgs e)
        {
            _panel3D.MoveItems(3, false, ANIMATION_LENGTH);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
United States United States
Dr. WPF is a WPF Disciple! Check out the doctor's blog and bio for more information.

Comments and Discussions