[英]Passing Values between two xaml Pages in Windows Phone 8 App
在下面的代碼,我想通過TextBlock1的值,它是在導航頁面的TextBlock2這是在目標頁面...!
導航頁中的代碼 :
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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.