在xaml页面中传递值 [英] Passing values in xaml pages
本文介绍了在xaml页面中传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
试图将xaml页面中的值传递给另一个。使用下面的代码帮助
Page 1
private void btnEmailLogin_Click( object sender,RoutedEventArgs e)
{
string emailAddress = txtEmailAddress.Text;
string txtPasswords = txtPassword.Text;
NavigationService.Navigate( new Uri( string .Format( / EmailSender.xaml?emailAddress = {0}& txtPasswords = {1},emailAddress,txtPasswords),UriKind.Relative) );
}
Page 2
if ( this .NavigationContext.QueryString.ContainsKey( emailAddress)|| this .NavigationContext.QueryString.ContainsKey( password))
{
此 .txtFrom.Text = 此 .NavigationContext.QueryString [ EMAILADDRESS跨度>];
}
我在if语句中得到nullRefrenceException ...需要帮助
解决方案
http://social.msdn.microsoft.com/Forums/windowsapps/en-美国/ 4457ffd6-944e-4ee9-a8c4-fd36c6a98a32 /如何对transwer-A-图像一个XAML到另一个-XAML的同时单击-A-按钮功能于Metro风格,使用-C [ ^ ]
我认为以上链接可以帮到你。
谢谢,
Bilaal
Been atempting to pass values in xaml page to another.Help with the code below
Page 1
private void btnEmailLogin_Click(object sender, RoutedEventArgs e)
{
string emailAddress = txtEmailAddress.Text;
string txtPasswords = txtPassword.Text;
NavigationService.Navigate(new Uri(string.Format("/EmailSender.xaml?emailAddress={0}&txtPasswords={1}", emailAddress, txtPasswords), UriKind.Relative));
}
Page 2
if (this.NavigationContext.QueryString.ContainsKey("emailAddress") || this.NavigationContext.QueryString.ContainsKey("password"))
{
this.txtFrom.Text = this.NavigationContext.QueryString["emailAddress"];
}
I get a nullRefrenceException in the if statement...Need help
解决方案
http://social.msdn.microsoft.com/Forums/windowsapps/en-US/4457ffd6-944e-4ee9-a8c4-fd36c6a98a32/how-to-transwer-a-image-one-xaml-to-another-xaml-while-clicking-a-button-in-metro-style-using-c[^]
I think the above link will help you.
Thanks,
Bilaal
这篇关于在xaml页面中传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文