Windows Phone导航-返回之前的页面 [英] Windows Phone Navigation - Passing back to the page before
本文介绍了Windows Phone导航-返回之前的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想单击一个按钮将我带到页面 ,然后单击列表框项,单击新页面上的按钮,然后将其传递回该页面,然后再不创建第一页的新URI.
I would like to click on a button to take me to a page , then click on a listbox item, click on a button on the new page and pass it back to the page before without creating a new URI of the first page.
**First Page**
private void btnAddExistingMember_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/ChooseMember.xaml", UriKind.Relative));
}
**Second page after choosing listbox value**
private void btnAddSelected_Click(object sender, RoutedEventArgs e)
{
Member currMember = (Member)lstMembers.SelectedItem;
string memberID = currMember.ID.ToString();
//navigate back to first page here passing memberID
}
能做到吗?
谢谢
推荐答案
您可以将成员存储在App.xaml.cs文件中.这是应用程序中所有文件均可访问的通用文件. 就像全局变量一样.
You can store the member in the App.xaml.cs file. This is common file accesssible for all files in the application. This works like a global variable.
//App.xaml.cs
int datafield ;
//Page1xaml.cs
(App.Current as App).dataField =10;
//Page2.xaml.cs
int x = (App.Current as App).dataField
这篇关于Windows Phone导航-返回之前的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文