WP8——页面跳转方法

来源:转载

 

1.页面传值:
 this.NavigationService.Navigate(new Uri("/SecondPage.xaml?CustomerId=1234&Product=555", UriKind.Relative));
 
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
 base.OnNavigatedTo(e);
 
 foreach (var item in NavigationContext.QueryString)
 {
 MessageBox.Show("Query String [" + item.Key + "] = " + item.Value);
 }
 }
 
或:
 this.NavigationService.Navigate(new Uri("/SecondPage.xaml#HelloWorld",
 UriKind.Relative));
 
 Protected override void OnFragmentNavigation(System.Windows.Navigation.FragmentNavigationEventArgs e)
 {
 base.OnFragmentNavigation(e);
 
 MessageBox.Show("Fragment: " + e.Fragment);
 }
 
2.在非页面层调用页面跳转: 
 //跳转页面
 (Application.Current.RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame
 ).Navigate(new Uri("/MainPages/SecondPages/GameDetails.xaml", UriKind.Relative));



分享给朋友:
您可能感兴趣的文章:
随机阅读: