3. WHAT IS MVVM?
• A weird acronym
– Model – View – ViewModel
• Woven into WPF/SL/WP
• Some confusion:
– MVVM is really just the pattern
– The rest are helpers, practices, etc.
• Why does MVVM pattern is best for
WPF/SL/WP?
-WPF/SL/WP Controls are developed using
MVVM internally.
7. BLENDABILITY
• Testability, Maintainability, Blendability
• “The ability to be edited in Blend”
–(and Visual Studio designer…)
• Differentiate code in design and runtime
• Create design time data
/* Life runs on code */ 7
8. BRIDGING THE GAP
/* Life runs on code */ 8
View
ViewModel
DataBinding Commands Messages
Model
9. BRIDGING THE GAP
/* Life runs on code */ 9
View
ViewModel
View
ViewModel
View
ViewModel
11. COMMANDS
• “Point of entry” for a method
• Can be data bound
• ICommand interface
–Execute method
–CanExecute method
–CanExecuteChanged event
/* Life runs on code */ 11
13. DEBUNK THE MYTHS
• “No code in the code behind”
– “If you put code in the View's code-behind, the
MVVM police will take your family away”
– “No need for converters”
• “MVVM is suitable for big projects”
• “MVVM costs performance”
• “MVVM is complex / makes my head hurt”
/* Life runs on code */ 13
14. DEBUNK THE MYTHS
• “I don’t need separation because I don’t
have a designer”
• “You cannot use MVVM with other
patterns”
• “MVVM will make you rich and attractive”
/* Life runs on code */ 14
15. MVVM LIGHT TOOLKIT
• “Breaking the monotony”
• http://www.galasoft.ch/mvvm/getstarted
• http://mvvmlight.codeplex.com
• Keep it small
• Keep it simple
/* Life runs on code */ 15