简体   繁体   English

导航到页面上的处理导航

[英]Handling Navigation on the page navigated to

My application requires that I navigate from one page to another in wpf on the click of a button, and pass a parameter with the URL like this : 我的应用程序要求我单击一下按钮即可在wpf中从一页导航到另一页,并使用如下URL传递参数:

 this.NavigationService.Navigate(new Uri("Page2.xaml?article="+textBoxContent.Text, UriKind.Relative));

Now, I want to retrieve this data on page2. 现在,我想在第2页上检索此数据。 There is a method like 'OnNavigatedTo' in Windows Phone 7 that we can override. Windows Phone 7中有一种可以覆盖的方法,例如“ OnNavigatedTo”。 How to do it in wpf? 如何在WPF中做到这一点?

试试这个:在Page2的OnNavigatedTo方法中

    var article = navigationContext.Parameters["article"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM