Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 30th, 2012  |  syntax: C#  |  size: 1.22 KB  |  views: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class GoNextControl: ContentControl
  2.     {
  3.         //NextPage where you want to move upon control click
  4.         public string NextPage { get; set; }
  5.         public string sbNames { get; set; }
  6.         public bool IsNavigatingToNextPage { get; set; }
  7.  
  8.         public GoNextControl()
  9.         {
  10.             this.Loaded += new RoutedEventHandler(GoNextControl_Loaded);
  11.             this.Unloaded+=new RoutedEventHandler(GoNextControl_Unloaded);
  12.         }
  13.  
  14.         void GoNextControl_Loaded(object sender, RoutedEventArgs e)
  15.         {
  16.             this.IsNavigatingToNextPage = false;
  17.         }
  18.  
  19.         protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
  20.         {
  21.             this.IsNavigatingToNextPage = true;
  22.             var parentframe = App.Current.RootVisual as PhoneApplicationFrame;
  23.             parentframe.Navigate(new Uri(NextPage, UriKind.Relative));
  24.             base.OnMouseLeftButtonDown(e);
  25.             parentframe = null;
  26.         }
  27.  
  28.         void GoNextControl_Unloaded(object sender, RoutedEventArgs e)
  29.         {
  30.             this.Loaded -= new RoutedEventHandler(GoNextControl_Loaded);
  31.             this.Unloaded -= new RoutedEventHandler(GoNextControl_Unloaded);
  32.         }
  33.        
  34.     }