在两个视图模型之间进行通信的最佳方法是什么(使用MVVM和Prism 4.0) [英] What is the best approach to communicate between Two view-models (Using MVVM & Prism 4.0)

查看:96
本文介绍了在两个视图模型之间进行通信的最佳方法是什么(使用MVVM和Prism 4.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试确定多视图模型通信机制的最佳appraoch(例如:View-Model A和View Model B松散耦合。现在我想将一个参数值传递给我的View Model B来自A.不想使用EvenAggregator并且模型是独立的。



事件聚合器是可用选项之一但是我试图避免使用正常由于安全性(由于其全局行为)的沟通。



我在我的应用程序中使用了一个控制器,可以轻松地在两个视图模型之间路由数据。 MVVM和Prism 4.0中的控制器是一个好方法吗?



如果没有,那么有人会建议或指导我采用更好的方法吗?

I am trying to identify the best appraoch for multiple view-models communication mechanism (eg: View-Model A & View Model B are loosely coupled. Now I want to pass one parameter value to my View Model B from A. I don''t want to use EvenAggregator and the models are independent).

The Event Aggregator is one of the option available however i am trying to avoid that usage for normal communication because of the security (due to its Global behaviour).

I used a controller in my Application and can easily route the data between two view-models. Is the controller in MVVM & Prism 4.0 a good approach?

If not, then can some one suggest or direct me to the better approach?

推荐答案

最好的方法是创建服务的中间层
The best approach is to create an intermediate layer of Services


这篇关于在两个视图模型之间进行通信的最佳方法是什么(使用MVVM和Prism 4.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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