Here are the Basics:
- MVVM means Model, View and View Model (view’s model).
- The MVVM pattern provides a clean separation between application’s user interface, its presentation logic, and its business logic and data by separating each into separate classes.
- The view’s responsibility is to define the structure and appearance of what the user sees on the screen.
Ideally, the code-behind of a view contains only a constructor that calls the InitializeComponent method.
- The view model encapsulates the presentation logic and data for the view.
There is no direct reference from the view model to the view.
The view model defines public properties and commands that are used by the view to render the model.
- The model encapsulates business logic and data.
The model should not contain any user task specific behavior or application logic.Windows Runtime allows defining the view by using XAML and its code behind. The mapping between view model public properties and UI can be defined by using data binding mechanisms.
- A Game to Learn:
BubbleBurst is a fun and addictive game, based on the classic game called BubbleBreaker. It is the subject of Advanced MVVM, a book written by Josh Smith to help MVVM developers take their skills to the next level. The application architecture is based on the Model-View-ViewModel design pattern. Several difficult problems were solved in elegant, reusable ways, as explained in great detail by the book. And if that isn’t enough, the user interface was enhanced by several professional Visual Designers and User Experience gurus!Feel free to download the source code or binaries, even if you don’t buy the book.The application was compiled in Visual Studio 2008 with Service Pack 1. It requires .NET 3.5 SP1 to be installed in order to run properly.Have fun!
- A Game to Learn: