Just another tech site

(MVVM) Model-View-ViewModel


Intro

General Idea

Unlike the Presenter in MVP, a ViewModel does not need a reference to a view. The view binds to properties on a ViewModel, which, in turn, exposes data contained in model objects and other state specific to the view. The bindings between view and ViewModel are simple to construct because a ViewModel object is set as the DataContext of a view. If property values in the ViewModel change, those new values automatically propagate to the view via data binding. When the user clicks a button in the View, a command on the ViewModel executes to perform the requested action. The ViewModel, never the View, performs all modifications made to the model data [1]

The main idea of MVVM is to take full advantage of WPF Data-Binding to allow very loose coupling between the Controller and the View. This means the Controller does not have a reference to the View and the View only has an ‘object’ typed reference to the controller using its DataContext property.[2]

.

Reference

[1] http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
[2] http://blog.rees.biz/2010/02/mvvm-pattern.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: