
Untitled
By: a guest on
May 30th, 2012 | syntax:
C# | size: 1.22 KB | hits: 18 | expires: Never
public class GoNextControl: ContentControl
{
//NextPage where you want to move upon control click
public string NextPage { get; set; }
public string sbNames { get; set; }
public bool IsNavigatingToNextPage { get; set; }
public GoNextControl()
{
this.Loaded += new RoutedEventHandler(GoNextControl_Loaded);
this.Unloaded+=new RoutedEventHandler(GoNextControl_Unloaded);
}
void GoNextControl_Loaded(object sender, RoutedEventArgs e)
{
this.IsNavigatingToNextPage = false;
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
this.IsNavigatingToNextPage = true;
var parentframe = App.Current.RootVisual as PhoneApplicationFrame;
parentframe.Navigate(new Uri(NextPage, UriKind.Relative));
base.OnMouseLeftButtonDown(e);
parentframe = null;
}
void GoNextControl_Unloaded(object sender, RoutedEventArgs e)
{
this.Loaded -= new RoutedEventHandler(GoNextControl_Loaded);
this.Unloaded -= new RoutedEventHandler(GoNextControl_Unloaded);
}
}