MVVM ViewModel查看消息传递(MVVM ViewModel to View Messaging)
MVVM问题。 ViewModel和View之间的消息传递,如何最好地实现?
该应用程序有一些“用户通信”点,例如:“您已为此选择输入了注释。 当“是/否/ NA”选择的值发生变化时,您是希望保存还是“丢弃”。 所以我需要一些被禁止的View绑定到ViewModel的“消息”的方式。
我从MVVM Foundation的Messenger开始走下去。 然而,这更像是系统范围的广播,而不是事件/订户模型。 因此,如果应用程序有两个View实例(Person1 EditView和Person2 EditView)打开,当一个ViewModel发布“你想保存”消息时,它们都会收到消息。
你用了什么方法?
谢谢安迪
MVVM question. Messaging between ViewModel and View, how is it best implemented?
The application has some points of “user communication” such as: “You have entered comments for this selection. Do you wish to save or discard” when the value of a Yes/No/NA selection changes. So I need some proscribed way of the View binding to the ViewModel’s “messages” .
I went down path starting with MVVM Foundation's Messenger. However that is more of a system-wide broadcast then a event/subscriber model. So, if the app has two instances of a View (Person1 EditView and Person2 EditView) open they both get the message when one ViewModel publishes the "do you want to save" message.
What approach have you used?
Thanks Andy
原文:https://stackoverflow.com/questions/1981166