Note: the author of the blog http://www.galasoft.ch/mvvm/ from Laurent Bugnion provides a detailed introduction to the video and part of the samples source code (English), mvvm light toolkit also corresponds to the source code on codeplex, in the introduction video, Laurent introduced in detail the features, applications, and data message processing of the Model-View-viewmodel model. It is a good teaching material for mvvm learning;
As described in the Laurent blog, mvvm separates mode from view in SL, WPF, and WP7 to create simple, easy-to-maintain, and scalable applications.Program; Strong testability (view and model separation can be used for unit tests on the model), strong usability of the UI; the ease of use of the UI is mainly reflected in the ability to quickly design the interface in expression blend, in addition, toolkit provides data during design hours for UI designers to conveniently view the display of many data controls in the design UI (this will be introduced in the following chapter ); here I will introduce some of my understanding of the mvvm model.
1. mvvm mode structure
This is the MVC mode, which achieves the separation of view and model. Different view displays can be developed for the same model, and the model can be easily tested. The controller can manage requests and perform logical processing;
This is the mvvm mode. It has completely isolated the model and view, and the presentation model controls the program logic. Therefore, viewmodel can be tested independently;
2. Interaction between view and Mode
The viewmodel data is mainly displayed through databinding between the view and viewmodel, And the view can notify the viewmodel data changes (set binding mode );
User operations (such as click of a button) Notify viewmodel of logical processing by binding the corresponding command; commands will be detailed in the following sections;
Viewmodel updates the display of views through messages; model is used as a data processing component;
Environment Configuration:
If you have configured the WP7 development environment, install
Mvvm light toolkit V4 beta1 is ready. It includes SL, WPF, WP7 application templates, and components in toolkit;
If you have not configured the WP7 development environment, please refer to the Environment configuration in http://www.cnblogs.com/yoainet/archive/2011/12/02/2272479.htmlto install
After installation, you will have the following templates in vs2010:
Mvvm Silverlight
Mvvm WP7
Mvvm WPF
Now, we can start the mvvm development journey.