Query on MVVM pattern in WPF?

北战南征 提交于 2019-12-10 12:09:31

问题


I am implementing a MVVM pattern in my WPF application.

My application main window is divided into four parts:

  1. Main Menu On the Top
  2. Outlook Navigation Control on the Left.
  3. A List View on the Middle.
  4. Another List view on the bottom.

The Navigation control shows different setting (configuration) controls in the Tab items.

All the four above are user controls which are placed in the main window.

And corresponding to each user control there is separate view model which is bounded with a view model in the XAML of each control, however the model class remain the same between all the view model.

And a MainWindow has a seperate View Model which is also bounded with a view model in the XAML of each control.

Please help me out in framing a design in which each view models of all the controls above will interact with each other.

Please let me know if my question is not clear to you!!


回答1:


Ideally your changes to the model should trigger the changes to the ViewModels. If I understand your question correctly you shouldn't need the ViewModels to interact directly with each other and might already have been answered here:

MVVM - what is the ideal way for usercontrols to talk to each other




回答2:


You might have a look at the sample projects of the WPF Application Framework.



来源:https://stackoverflow.com/questions/2430376/query-on-mvvm-pattern-in-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!