In a wpf application, Whats the responsibility of the viewmodel? can he manage everything or only represent the view and send messages/event to the business layer and get information from it?
In a wpf application, Whats the responsibility of the viewmodel? can he manage everything
Share
Short answer, Yes.
Longer answer …
The main aims of the Model-View-ViewModel (MVVM) pattern are:
The MVVM pattern also provides separation of concerns between view logic and business logic in the same way that the MVC and their UI pattern do. However, the 2 points above are what really define the MVVM pattern.
Now, thinking about where you locate your business logic. If you place it in your ViewModel, are #1 & #2 above still valid? Yes. If you place it in a separate layer, are #1 and #2 still valid? Yes.
Therefore, in both cases you are still achieving the two main goals of MVVM. Which route you take really depends on the complexity of your application, and the number of developers working on it. As both these factors increase, you will benefit from having 3 layers … or more!