An Introduction to the Model-View- ViewModel Pattern

Post on 06-Jan-2016

55 views 0 download

description

An Introduction to the Model-View- ViewModel Pattern. rakeshk@damcogroup.com rakesh308@gmail.com. WPF. Intoduced in 3Framework 3.0. XAML UI Language. Vector Based rendering. Rich Composition ……………. ……………. ……………. TWO WAY DATABINDING. What is MVVM?. M odel V iew V iew M odel. - PowerPoint PPT Presentation

Transcript of An Introduction to the Model-View- ViewModel Pattern

rakeshk@damcogroup.comrakesh308@gmail.com

rakeshk@damcogroup.comrakesh308@gmail.com

An Introduction to the Model-View-ViewModel Pattern

An Introduction to the Model-View-ViewModel Pattern

WPFIntoduced in 3Framework 3.0.XAML UI Language.Vector Based rendering.Rich Composition…………….…………….…………….TWO WAY DATABINDING

What is MVVM?ModelViewViewModel

Standing on the Shoulders of Giants

MVCMVP

Martin Fowler Josh Smith John GossmanSean Wildermuth

Martin Fowler Josh Smith John GossmanSean Wildermuth

Why MVVM?Separation Of ConcernsTest Driven ApproachCode Cleanliness & Modular ApproachSupport WPF two way Data binding feature.

How Do We Achieve that?

View

ViewModel

Model

DONOT FOLLOW THIS

View

ViewModel

Model

View View

A More Complete Diagram

ViewXAML, Code Behind

Unit TestsIntegration Tests

ViewModelProperties, Commands, View Logic

Bin

din

gs

Actio

ns

Model

Service Proxies

Web

Data

Events

Behavio

r

DEMO – SAMPLE

MVVM Guidelines

1. Reduce or eliminate your code-behind

2. Bind all of your UI inputs/outputs to your ViewModel

3. Implement INotifyPropertyChanged on your ViewModel

4. When testing, treat ViewModel as the Real UI

5. Avoid events.  Use commands instead

Third Party SupportPrismMVVM LightCaliburnSilverlight FX