[英]How to pass query string parameters from one page and get in another in WP 7 using MVVM Light
I am developing application in Windows Phone 7 in MVVM arhticeture. 我正在MVVM arhticeture中开发Windows Phone 7中的应用程序。 I have never worked with MVVM Light. 我从未使用过MVVM Light。 But today for sending querystring parameters from ViewModel of first Page to another, I have searched google and found that I have to use MVVMLight. 但是今天为了从第一页的ViewModel向另一个页面发送查询字符串参数,我搜索了谷歌并发现我必须使用MVVMLight。 But I cant find any tutorial or working sample. 但我找不到任何教程或工作样本。 I have found one that it navigates from one page to another, but without parameters. 我发现它从一个页面导航到另一个页面但没有参数。
UPDATE How to change this solution that in can get parameters from OrderViewModel? 更新如何更改可以从OrderViewModel获取参数的解决方案? code can be found here 代码可以在这里找到
You use a concept called messaging. 您使用称为消息传递的概念。 Read more on Geoff's Blog: MVVM Light - Passing Params to Target ViewModel Before Navigating . 阅读更多关于Geoff的博客: MVVM Light - 在导航之前将Params传递给目标ViewModel 。
Basically, you send a message of some type (represented by a C# class) and the target ViewModel registers itself as the recipient of that message. 基本上,您发送某种类型的消息(由C#类表示),目标ViewModel将自身注册为该消息的接收者。 Once you broadcast the message, the other view model will be called. 广播消息后,将调用另一个视图模型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.