欢迎访问移动开发之家(rcyd.net),关注移动开发教程。移动开发之家  移动开发问答|  每日更新
页面位置 : > > 内容正文

WP8——页面跳转方法

来源: 开发者 投稿于  被查看 46955 次 评论:20

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));
相关频道:

用户评论