如何将对象从 xaml 页面传递到另一个页面? [英] How to pass an object from a xaml page to another?

查看:20
本文介绍了如何将对象从 xaml 页面传递到另一个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用

NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" + textBox1.Text, UriKind.Relative));

但这仅适用于字符串值.我想将一个对象传递给 xaml 页面.我该怎么做?

But that is only for string values. I would like to pass an object to the xaml page. How do I do that?

在 SO 和 WP7 论坛上发现了类似的问题.解决方案是使用全局变量(不是最好的解决方案).

Found a similar question on SO and WP7 forum. The solution is to use a global variable (not the nicest solution).

WP7:将参数传递到新页面?

http:///social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/81ca8713-809a-4505-8422-000a42c30da8

推荐答案

查看启动新 DataBound 项目时创建的默认代码.它展示了一种将所选对象的引用传递到详细信息页面的方法.

Have a look at the default code created when you start a new DataBound Project. It shows a way of passing a reference to a selected object to a details page.

这篇关于如何将对象从 xaml 页面传递到另一个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆