简体   繁体   English

如何使用MVVM Light从一个页面传递查询字符串参数并在WP 7中获取另一个参数

[英]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.

相关问题 使用MVVM在WPF中将字段从一页传递到另一页 - Pass Field from one page to another page in WPF using MVVM 如何将参数从一页传递到另一页? - How to pass parameters from one page to another? 如何使用mvvm light将字符串从视图传递到Xamarin表单中的视图模型 - How to pass a string from a view to its view model in Xamarin forms using mvvm light 如何使用MVVM光处理WP 8.1上的后退按钮? - How to handle the back button on WP 8.1 using MVVM light? 如何使用mvvm light和Modern UI和依赖项注入关闭登录页面并重定向到另一个页面 - how to close login page and redirect to another page using mvvm light and Modern UI and dependency injection MVVM Light:如何从用户控件获取数据? - MVVM Light: How to get data from usercontrols? 在wp8中将对象从一页传递到另一页 - Pass object from one page to another in wp8 如何在没有 mvvm light 的情况下将参数传递给导航页面的视图模型 - How to pass a parameter to the viewmodel of the navigated page without mvvm light 在wp7上使用mvvm light进行条件绑定 - Conditional binding using mvvm light on wp7 如何将多个字符串值从一页传递到另一页? - How to pass multiple string values from one page to another?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM