To make the View completely independent of the Model, you will need to reproduce types that in many cases are identical to the types of the model in your ViewModel.
Example
The model contains the type Person , which has the FirstName and LastName properties. The visual design requires a "List of People", so there is a view containing a ListBox that binds the data template to the FirstName and LastName property paths. ItemsSource tied to the ViewModel property, which provides many instances of types that have the FirstName and LastName properties.
So here's the question: should there be a version of the ViewModel of type Model Person or should the ViewModel reuse the existing type of Person from the Model?
In any case, it is entirely possible that you want the properties to be visible.
To consider
What are the goals of MVVM? Quite often, we like to present good long lists of why the template exists, but in this case there really are only 2.
- Separate visual design ( note : not design) from the code.
- Enlarge the test surface of the entire application.
Displaying model types in the ViewModel does not interfere with any of the above goals. In fact, this helps to test, since the number of types and members that need testing is reduced.
In my opinion, I do not see that the implementation of INotifyPropertyChanged implies binding to visual effects. There may be other reasons why some services may want to observe changes in the properties of the model object.
The key principle for separating a model from a view is to hide any features of how the view represents the model from the model itself. Adding the ForenameBackColor property to the model would probably be bad. Here is the ViewModel.
Bottom row
The requirement that the model display observable properties is not a violation of MVVM, its simple and general requirement, which does not require the Model to have any specific knowledge about any representation or really that there are any βvisual effects.β p>
source share