Wednesday, August 18, 2010

MVVM 101

Model: the Data. Holds the information, but not behaviors or services that manipulate the information.

View: the presentation of the data (ex. the xaml in Silverlight). Contains behaviors, events, and data-bindings that ultimately require knowledge of the underlying model and viewmodel. Not responsible for maintaining its state. Instead, it will synchronize this with the viewmodel. Bindings are the integration/synchronization points with the viewmodel (ex. <TextBlock Text="{Binding FullName}" />

ViewModel: the Controller. Liason between Model and View. Might take input from the view and place it on the model, or it might interact with a service to retrieve the model, then translate properties and place it on the view. Maintains state of the View. Triggers events in the view.

source: http://csharperimage.jeremylikness.com/2010/04/model-view-viewmodel-mvvm-explained.html

Posted via email from Mocha Brain Freeze

No comments: