Upload
ashtewari
View
2.909
Download
6
Tags:
Embed Size (px)
DESCRIPTION
Slidedeck from "Getting Started with MVVM" presentation at RDU Code Camp 2010.
Citation preview
Getting started with MVVMModel-View-ViewModel
Ash Tewariwww.ashtewari.com
@ashtewari
2
Introductions
• Introductions• Announcements• Share contact information
3
Survey
• Do you work with WPF or Silverlight ?• How familiar are you with MVVM ?– Heard about it– Read about it– Played around with it– Used it in a production application
4
Stupid Questions Policy
5
Why ?
WPF Features– Data Binding– Data Templates– Resources– Commands
6
Why ?
Decouple View from its State and Behavior – Code is easy to understand, maintain, evolve and troubleshoot
7
Why ?
Testability – Automated Regressions
8
Why ?
Easily skin user interfaces
9
Why ?
Designer/Developer Workflow – Allows Specialists to work on the same project without much friction
10
Sample Application
• MSDN Magazine Article :
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
• Sample Application Download:
http://code.msdn.microsoft.com/mag200902MVVM/Release/ProjectReleases.aspx
11
Demo
Structure of demo application
12
M-V-VM
• Model• View• ViewModel
13
Demo
Add “Search” feature to the demo application
14
Take Away
Model does not know about View and ViewModel.
15
Take Away
ViewModel is an abstraction of the View. It encapsulates the State as well as the behavior of the View.
16
Take Away
ViewModel does not have a reference to the View.
17
Take Away
ViewModel implements INotifyPropertyChanged.
18
Take Away
ViewModel is assigned to the DataContext property of the View.
19
Resources
• Advanced MVVM Book– http://joshsmithonwpf.wordpress.com/advanced-
mvvm/
• BubbleBurst Sample Application– http://bubbleburst.codeplex.com/
20
Resources
• Comparison of MVVM Frameworks– http://www.japf.fr/2009/11/discover-compare-exi
sting-mvvm-frameworks/
• MVVM Light Toolkit– http://www.galasoft.ch/mvvm/getstarted/