从页面到页面传递数据 [英] Passing data from page to page

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

问题描述

我正在寻找有关如何在页面之间传递数据的最佳实践.

I'm looking for the best practice on how to pass data from page to page.

在页面 A 中,我有一个按钮可以触发页面 B.
在页面 B 上,我有 6 个文本框,允许用户输入信息.当用户完成后,点击一个按钮将他们带回页面 A.

In Page A I have a button that fires off Page B.
On Page B I have 6 textboxes that allow the user to enter information. When the user is done, the click on a button that brings them back to Page A.

我想将该数据传回页面 A.

I want to pass that data back to Page A.

我看到了以下建议:

  • 构建 XML 文档并保存到独立存储
  • 使用 App 类在属性中存储信息
  • 像查询字符串一样传递它

我正在寻找最佳实践.是否有 Microsoft 推荐的或公认的最佳方式?

I'm looking for the Best practice. Is there one that Microsoft recommends or one that is generally accepted as the best way?

谢谢

推荐答案

PhoneApplicationService.Current.State["yourparam"] = param
NavigationService.Navigate(new Uri("/view/Page.xaml", UriKind.Relative));

然后在其他页面简单

var k = PhoneApplicationService.Current.State["yourparam"];

这篇关于从页面到页面传递数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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