UI Application Logic Out of the box approach View ViewModel Model Model-View-ViewModel (MVVM)
An Introduction to the Model-View- ViewModel Pattern
description
Transcript of An Introduction to the Model-View- ViewModel Pattern
[email protected]@gmail.com
[email protected]@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