C# 在Windows Phone 8应用程序的两个xaml页面之间传递值
在下面的代码中,我想将导航页面中的TextBlock1的值传递给目标页面中的TextBlock2 导航页面中的代码:C# 在Windows Phone 8应用程序的两个xaml页面之间传递值,c#,C#,在下面的代码中,我想将导航页面中的TextBlock1的值传递给目标页面中的TextBlock2 导航页面中的代码: NavigationService.Navigate(new Uri("/Views/DestinationPage.xaml?parameter=textBlock1.Text", UriKind.Relative)); string parameter = string.Empty; if (NavigationContext.QueryString.Try
NavigationService.Navigate(new Uri("/Views/DestinationPage.xaml?parameter=textBlock1.Text", UriKind.Relative));
string parameter = string.Empty;
if (NavigationContext.QueryString.TryGetValue("parameter", out parameter))
{
this.textBlock_Result.Text = parameter;
}
目标页面中的代码:
NavigationService.Navigate(new Uri("/Views/DestinationPage.xaml?parameter=textBlock1.Text", UriKind.Relative));
string parameter = string.Empty;
if (NavigationContext.QueryString.TryGetValue("parameter", out parameter))
{
this.textBlock_Result.Text = parameter;
}
导航页面:
NavigationService.Navigate(new Uri("/Views/DestinationPage.xaml?parameter=" + textBlock1.Text, UriKind.Relative));
目的地页面:
if(NavigationContext.QueryString.TryGetValue(“parameter”,out parameter))
{
this.textBlock_Result.Text = parameter;
}