Windows Phone Navigation - 回传到之前的页面 [英] Windows Phone Navigation - Passing back to the page before
本文介绍了Windows Phone Navigation - 回传到之前的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想点击一个按钮将我带到一个页面,然后单击一个列表框项,单击新页面上的一个按钮并将其传递回之前的页面,而不创建第一页的新 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 Navigation - 回传到之前的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文