Understanding MVVM
Model-View-ViewModel (MVVM) is a design pattern like MVC. The letters in the acronym stand for:
- Model: An entity class that represents a data object in a store like a relational database.
- View: A way to represent data in a graphical user interface including fields to show and edit data fields and buttons and other elements to interact with the data.
- ViewModel: A class that represents the data fields, actions, and events that can then be bound to elements like text boxes and buttons in a view.
In MVC, models passed to a view are read-only because they are only passed one-way into the view. That is why immutable records are good for MVC models. But view models are different. They need to support two-way interactions and if the original data changes during the lifetime of the object, the view needs to dynamically update.
INotifyPropertyChanged interface
The INotifyPropertyChanged
interface enables a model class to support two...