如何在 WP7 的 Silverlight 页面之间传递值? [英] How to pass a value between Silverlight pages for WP7?

查看:28
本文介绍了如何在 WP7 的 Silverlight 页面之间传递值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MainPage.xaml 页面和一个 Detail.xaml 页面.

I've got a MainPage.xaml page a Detail.xaml page.

我已经通过使用静态变量并在 Detail.xaml 中引用它从 MainPage.xaml 将变量传递给 Detail.xaml(详细信息页面就像一个对话框).但是,一旦我更新了另一个对象的内容,我想调用 MainPage.xaml 中的一个方法,以使用 Detail.xaml 页面中的更新对象刷新该页面的内容.

I've passed variables to the Detail.xaml from MainPage.xaml by using a static variable and referencing it in Detail.xaml (the detail page is acting like a dialog). However once I've updated the content of another object, I want to call a method in MainPage.xaml to refresh the content of that page using the updated object from the Detail.xaml page.

我认为我没有为此使用正确的范例,可能应该使用 MVVM 或其他东西,但我不熟悉实现并希望有一种简单的方法来做到这一点?

I assume I am not using the correct paradigm for this and should probably be using MVVM or something but I'm not familiar with the implementation and was hoping there was a simple way to do this?

推荐答案

您能否将静态内容加载到 OnNavigatedTo 中的控件中?

Can you load the content from the static into your control in the OnNavigatedTo?

您可以在主页中创建一个方法来完成这项工作并调用它.

You can make a method in your main page to do that job and call that.

这篇关于如何在 WP7 的 Silverlight 页面之间传递值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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