What are the biggest pain points with a ViewModel?

Glenn Block, and I worked together on the ViewModel template. We tried to identify the biggest pain points associated with the pattern, in order to add support frames to relieve pain.

Tonight, Glenn published, "View Model" - the film, spoke its voice . We are waiting for your reply. Please post here (and vote) what are the biggest pain points when implementing the ViewModel (also known as Model-View-ViewModel or MVVM). Tell us how the system will simplify your life!

We look at both WPF and Silverlight.

So, tell us what you want the framework to do to simplify the ViewModel?

+3
source share
4 answers
  • Explosion of an object (now we have a model and a representation model).
  • Matching a model with a viewing model and vice versa.

I think both are inexplicable zolots, but they are points of pain.

+5
source

Collections.

I want my model to have a collection of other Model objects, but bind my GUI to a collection of ViewModel objects.

I can create ObservableCollection<TViewModel>a ViewModel at my level and manually populate it with a ViewModel for each item in the model level collection. This works well when the program starts. But what happens when a user clicks the Add button? Or the delete button? Or moving up / down? Etc.

, , ViewModel Model, , ( ), , . (?)

+4

INotifyCollectionChanged , WPF . , 10 , 10 , !

, SuspendNotifocations ResumeNotifications Observable WPF ( : , , , ).

+1

Too many properties to create in the ViewModel class. At least what I saw for each property of the user interface element that you want to get / bind, you need to create a property in the ViewModel for which there is too much code.

0
source

Source: https://habr.com/ru/post/1707671/


All Articles