Download presentation
Presentation is loading. Please wait.
Published byDarrell Tardif Modified over 10 years ago
1
USING THE MODEL-VIEW- VIEWMODEL PATTERN Laurent Bugnion Director, User Experience Integration IdentityMine http://[blog|www].galasoft.ch
2
Page: WHAT IS MVVM? © 2011 IdentityMine Inc. All Rights Reserved.2 A weird acronym –Model – View – ViewModel Woven into WPF / Silverlight / WP7 Some confusion: –MVVM is really just the pattern –The rest are helpers, practices, etc
3
Page: THE MVC PATTERN © 2011 IdentityMine Inc. All Rights Reserved.3 ModelView Controller
4
Page: THE PASSIVE VIEW PATTERN © 2011 IdentityMine Inc. All Rights Reserved.4 ModelView Controller
5
Page: © 2011 IdentityMine Inc. All Rights Reserved.5 THE PRESENTATION MODEL PATTERN ModelView Presentation Model (ViewModel) DataBinding
6
Page: ADVANTAGES © 2011 IdentityMine Inc. All Rights Reserved.6 Testability, Maintainability, Blendability “The ability to be edited in Blend” –(and Visual Studio designer…) Differentiate code in design and runtime Create design time data
7
DEMO © 2011 IdentityMine Inc. All Rights Reserved. 7Page: Hello MVVM (and Hi Blend)
8
Page: BRIDGING THE GAP © 2011 IdentityMine Inc. All Rights Reserved.8 View ViewModel DataBindingCommandsMessages Model
9
Page: BRIDGING THE GAP © 2011 IdentityMine Inc. All Rights Reserved.9 View ViewModel View ViewModel View ViewModel Messages + callback
10
Page: COMMANDS © 2011 IdentityMine Inc. All Rights Reserved.10 “Point of entry” for a method Can be data bound ICommand interface –Execute method –CanExecute method –CanExecuteChanged event Not available in WP7 –(but there are ways around that ;)
11
DEMO © 2011 IdentityMine Inc. All Rights Reserved. 11Page: Commands and RelayCommands Messaging
12
Page: MVVM LIGHT TOOLKIT © 2011 IdentityMine Inc. All Rights Reserved.12 “Breaking the monotony” http://www.galasoft.ch/mvvm/ http://mvvmlight.codeplex.com V3 released at MIX10 Keep it small Keep it simple
13
Page: CALIBURN / MICRO © 2011 IdentityMine Inc. All Rights Reserved.13 Rob Eisenberg Convention over configuration http://caliburn.codeplex.com Also available for Windows Phone 7 –Caliburn.Micro
14
Page: FLAWS OF MVVM © 2011 IdentityMine Inc. All Rights Reserved.14 Too much code needed –INotifyPropertyChanged –Commands Some operations are tricky (set focus, navigation…) Not really applicable to ASP.NET, etc
15
FURTHER INFORMATION http://blog.galasoft.ch http://www.galasoft.ch/mvvm @LBugnion http://www.galasoft.ch/mvvmvideo1
16
THANKS!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.