SHOW:
|
|
- or go back to the newest paste.
| 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 | } |