当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - How to use the ViewModel-First approach?

问题描述:

Is there any framework that facilitates this approach without much hassle?

It seems frameworks like MVVM Light are more view-first focused.

网友答案:

yeah. There are many frameworks to build MVVM applications:

  • MVVM Light and Caliburn.Micro. They are relatively simple and lightweight. It wouldn't take you long to get up and running.

  • Prism is really cool framework. However, it will take more time to learn, than the above frameworks. However, you can build really a big application divided on modules.

  • Catel is not just an MVVM toolkit. As it also includes user controls and lots of enterprise library classes.

Update:

My opinion is that it is not their deal of these frameworks to emphasize ViewModel First or View First approach and these frameworks don't create any hassles when you use ViewModel First or View First approach. Even if you've chosen ViewModel First approach and you want to change this approach to View First approach, then there will be no hassles.

In my view these frameworks are designed for these goals:

  • Avoiding implementation INotifyPropertyChanged(just use built-in implementations(ViewModelBase in MVVMLight and BindableBase in Prism))

  • Simplifying changing views between modules(in Prism is IRegion.RequestNavigate(...); )

  • Communicating between viewModels(IEventAggregator in Prism and MessengerInstance.Send(payload, token); in MVVMLight). You do not to have to write your code. There are already created tested code for you in these frameworks.

  • Dependency Injection. You can decouple implementations of Views from their ViewModels through interface.

and the above list is not complete

分享给朋友:
您可能感兴趣的文章:
随机阅读: