开发者

Communication between viewModels in MVVM Light

I read couple of places that people use messenger to communicate between two different viewModels. But as I load all viewModels from my main viewModel, is it a wrong practice开发者_如何转开发 to set property values using those viewModel instance in main viewModel?


MVVM is great for separating your view from your code so that you can get a better designer-developer workflow (i.e. designer can edit the view in blend), and testing (i.e. you can unit test your logic without a view, in a headless mode). The problem is, when people start using MVVM they feel they need all the other loose-coupling patterns to, IoC, DI, etc ...

Basically, if you are happy communicating directly between your ViewModels (and yes, I do that all the time), and you can test your code (that is if you choose to test it ... it really is optional, but don;t tell anyone I said that!). Then, go for it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜