|
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace CarSelector
{
public class MainContent : Control
{
#region Members
#endregion
#region Properties
private Storyboard startingTransition;
private Storyboard endingTransition;
private UserControl newPage;
private ContentControl view;
#endregion
#region Events
#endregion
#region Constructor(s)
public MainContent()
{
DefaultStyleKey = typeof(MainContent);
}
#endregion
#region Event Handlers
#endregion
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
base.OnApplyTemplate();
FrameworkElement containerGrid = (FrameworkElement)this.GetTemplateChild("LayoutRoot");
this.startingTransition = (Storyboard)containerGrid.FindName("StartingTransition");
this.endingTransition = (Storyboard)containerGrid.FindName("EndingTransition");
this.startingTransition.Completed += new EventHandler(startingTransition_Completed);
this.view = (ContentControl)containerGrid.FindName("View");
// start by loading list
(Application.Current as App).NavigateToList();
}
void startingTransition_Completed(object sender, EventArgs e)
{
if (newPage != null)
{
view.Content = newPage;
endingTransition.Begin();
}
}
public void Navigate(UserControl page)
{
newPage = page;
startingTransition.Begin();
}
}
}
|
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.
I'm working since 1999 in an IT environment: started developing in PROGRESS 4GL, then VB6 and am working since 2003 with C#. I'm currently transitioning to HTML5, CSS3 and JavaScript for the front-end development.
I started my own company (TRI-S) in 2007 and co-founded another one (Cogenius) in 2012.
Besides being a Microsoft Certified Professional Developer (MCPD) I'm also a Microsoft Certified Trainer (MCT) and am teaching .NET and JavaScript courses.