Is this a view model?
I'm still new to MVVM and am trying to understand the concepts.
I have a class generated by Linq To Sql for a table.
I want this class to look different, so I create a new class with some of the properties from the gener开发者_开发问答ated class and a few new properties, that is only dependent on generated class.
Is this class a model, a view model or something different?
ViewModel
represents the state and behavior of the View. I would call a class a ViewModel
if:
- It provides property change notification through
INotifyPropertyChanged
- Has commands for the view
- Provies a model for the view, by specializing the model for easier data binding (formatting etc)
Could be a View Model, but not necessarily. Are these extra properties there for the purpose of supporting a view. If yes, then you could argue that it's a view model class.
View Models exist because views exist. Models exist because you have a domain of data. the View Model greases the skids between reality (model) and a given users perception of that reality (the view)
精彩评论