[英]How to navigate data from page to page?
当选择一个项目时,我需要在新页面中显示longlistselector数据..我收到错误消息System.Argument.Exception所以plz帮助我解决这个问题..
我的selectedindex更改代码..
private void OrganizationList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
NavigationService.Navigate(new Uri("Organization_Details.xaml?selectedItem" +Organization.Name , UriKind.Relative));
}
错误:
在导航页面中,我正在使用文本块显示我的数据..代码是..
Organization org;//Class name with obj
public Organization_Details()
{
InitializeComponent();
org_name.Text = org.name;//textblock(org_name)-->needs to set the data from the b4 page..
}
导航页面出错...
尝试这个
NavigationService.Navigate(new Uri("/Organization_Details.xaml?selectedItem=" +Organization.Name , UriKind.Relative));
您在网址的开头错过了“/” ,在selectedItem之后错过了“=”
您无法直接获取该值,因此请使用以下函数,
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.Uri.OriginalString.Contains("selectedItem"))
{
//Get the value here
}
}
这对你来说很好!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.