MVVM (Model-view-view-model) Simple analysis (and code example)

Source: Internet
Author: User

The project team, now using the MVVM (Model-view-view-model) pattern, has been engaged for one months and feels a little bit clear.

The MVVM framework, which is limited to the WPF that we use, is the View folder: The main interface (view)-related. xaml and corresponding. cs files are heavily used for binding (usually the source of most of the binding points to the corresponding model, Then, in the constructor of the corresponding. cs file, the DataContext = corresponding VM class is usually used. At this point, DataContext is at the window level. This associates the data with the VM, and in the corresponding VM, there is usually a property that declares a corresponding model. The VM operates on the data in the model and is kept in sync through the binding technology and the controls on the interface. In this way, the data and interface are separated, and the logic of data manipulation is separated. Nature has the advantages of low-coupling, independent development, reusable model and VMS.

The first company, using MVC (Model-view-controller), is said to be so good at separating data and interfaces as MVVM does.

Write this today, be free, add diagrams, code, and more in detail.

Remember: Write a blog, in order to clarify ideas, help yourself better think about some technical details, as a memo, deepen the impression. So happy is good.

MVVM (Model-view-view-model) Simple analysis (and code example)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.