繁体   English   中英

在Windows Phone 8 App中的两个xaml页面之间传递值

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM