-
Notifications
You must be signed in to change notification settings - Fork 1
CSharpBible MVVM Tutorial
Joe Care edited this page Jan 29, 2025
·
9 revisions
MVVM - Tutorial
Lessons and best practices with the MVVM
The way MVVM works for displaying (generally handling) is by a technique called Property-change-notification. The ViewModel (-class) implements properties for all information that is about to display in a View. It notifies the View (window, Page, UserControl ...) of any change of it's properties. This is done by an event that tells everyone, that a property of an class has changed. The event contains the class as sender, and the name of the possibly changed property.
ICommand-Interface
The ICommand interface is used to signal a UserAction to the ViewModel.
This Interface propagates 3 things:
- An Execute-Method to execute something.
- A CanExecute-Function to signal whether the command can be excuted, or not.
- A CanExecuteChanged-event to signal that the state may have been changed.
The ViewModel exports ICommand-properties, so that the View can bind to them.