Upload
laurent-bugnion
View
6.225
Download
2
Tags:
Embed Size (px)
DESCRIPTION
The Model-View-ViewModel pattern (also called MVVM) is a hot topic in today’s Silverlight and WPF world. This pattern facilitates modern development techniques such as separation of concerns (decoupling), unit testing and test driven development, work with modern tools such as Visual Studio 2010, Expression Blend and more. In this session, Laurent (a user and promoter of MVVM since 2006) will introduce this pattern to you with many demos. We will talk about the basic components of a modern Silverlight or WPF application, and of additional helpers that will make your life as a developer much easier.
Citation preview
Understanding the MVVM patternLaurent Bugnion
Senior User Experience Integrator
IdentityMine
http[blog|www]galasoftch
What is MVVM
bull A weird acronymbull Model ndash View ndash ViewModelbull laquo MVVM in a SLOOB with SLUT raquo
bull Woven into WPFSLbull Some confusion
bull MVVM is really just the patternbull The rest are helpers practices etc
The MVC pattern
Model View
Controller
The Passive View pattern
Model View
Controller
The Presentation Model pattern
Model View
Presentation Model
(ViewModel)
DataBinding
Blendability
bull Testability Maintainability Blendability
bull ldquoThe ability to be edited in Blendrdquo
bull (and Visual Studio designerhellip)
bull Differentiate code in design and runtime
bull Create design time data
DEMO
Hello MVVM (and Hi Blend)
Bridging the gap
View
ViewModel
DataBinding Commands Messages
Model
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
What is MVVM
bull A weird acronymbull Model ndash View ndash ViewModelbull laquo MVVM in a SLOOB with SLUT raquo
bull Woven into WPFSLbull Some confusion
bull MVVM is really just the patternbull The rest are helpers practices etc
The MVC pattern
Model View
Controller
The Passive View pattern
Model View
Controller
The Presentation Model pattern
Model View
Presentation Model
(ViewModel)
DataBinding
Blendability
bull Testability Maintainability Blendability
bull ldquoThe ability to be edited in Blendrdquo
bull (and Visual Studio designerhellip)
bull Differentiate code in design and runtime
bull Create design time data
DEMO
Hello MVVM (and Hi Blend)
Bridging the gap
View
ViewModel
DataBinding Commands Messages
Model
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
The MVC pattern
Model View
Controller
The Passive View pattern
Model View
Controller
The Presentation Model pattern
Model View
Presentation Model
(ViewModel)
DataBinding
Blendability
bull Testability Maintainability Blendability
bull ldquoThe ability to be edited in Blendrdquo
bull (and Visual Studio designerhellip)
bull Differentiate code in design and runtime
bull Create design time data
DEMO
Hello MVVM (and Hi Blend)
Bridging the gap
View
ViewModel
DataBinding Commands Messages
Model
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
The Passive View pattern
Model View
Controller
The Presentation Model pattern
Model View
Presentation Model
(ViewModel)
DataBinding
Blendability
bull Testability Maintainability Blendability
bull ldquoThe ability to be edited in Blendrdquo
bull (and Visual Studio designerhellip)
bull Differentiate code in design and runtime
bull Create design time data
DEMO
Hello MVVM (and Hi Blend)
Bridging the gap
View
ViewModel
DataBinding Commands Messages
Model
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
The Presentation Model pattern
Model View
Presentation Model
(ViewModel)
DataBinding
Blendability
bull Testability Maintainability Blendability
bull ldquoThe ability to be edited in Blendrdquo
bull (and Visual Studio designerhellip)
bull Differentiate code in design and runtime
bull Create design time data
DEMO
Hello MVVM (and Hi Blend)
Bridging the gap
View
ViewModel
DataBinding Commands Messages
Model
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Blendability
bull Testability Maintainability Blendability
bull ldquoThe ability to be edited in Blendrdquo
bull (and Visual Studio designerhellip)
bull Differentiate code in design and runtime
bull Create design time data
DEMO
Hello MVVM (and Hi Blend)
Bridging the gap
View
ViewModel
DataBinding Commands Messages
Model
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
DEMO
Hello MVVM (and Hi Blend)
Bridging the gap
View
ViewModel
DataBinding Commands Messages
Model
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Bridging the gap
View
ViewModel
DataBinding Commands Messages
Model
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Bridging the gap
View
ViewModelView
ViewModel
View
ViewModelMessages
Messages+ callback
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Commands
bull ldquoPoint of entryrdquo for a methodrdquo
bull Can be data bound
bull ICommand interface
bull Execute method
bull CanExecute method
bull CanExecuteChanged event handler
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
DEMO
Commandsand RelayCommands
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
RelayCommands
RelayCommand MyCommand = new RelayCommand( () =gt () =gt true | false)
RelayCommandltTgt MyGenericCommand = new RelayCommandltTgt( p =gt p =gt true | false)
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Messaging
bull Should be simple by default
bull Possible to open filtered channels
bull To a target Type (or an Interface)
bull With a Token
bull With various Messenger instances
bull No constraints at all
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
DEMOMessaging
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Messaging
MessengerDefaultRegisterltTgt( this p =gt DoSomething(p))
MessengerDefaultSendltTgt(p)
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
MVVM Light Toolkit
bull ldquoBreaking the monotonyrdquo
bull httpwwwgalasoftchmvvmgetstarted
bull httpmvvmlightcodeplexcom
bull V3 released at MIX10bull Keep it smallbull Keep it simple
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
MVVM Light Libraries V3
bull ESSENTIALSbull RelayCommandbull Messengerbull ViewModelBase
bull EXTRASbull EventToCommandbull DispatcherHelper
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
MVVM Light Tools V3
bull Project templates (VS + Blend)
bull Item templates (VS + Blend)
bull Code snippets
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
DEMO
MVVM Light ToolkitUnityBlendability
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Flaws of MVVM
bullToo much code neededbull INotifyPropertyChangedbullCommands
bullSome operations are tricky (set focushellip)
bullNot applicable to ASPNET etcbullMessage to community is not clear
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Debunking the myths
bullldquoNo code in the code behindrdquobull ldquoIf you put code in the Views code-behind the MVVM police will take your family awayrdquo
bull ldquoNo need for convertersrdquo
bullldquoMVVM is only suitable for big projectsrdquo
bullldquoMVVM costs performancerdquobullldquoMVVM is complex makes my head hurtrdquo
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
Debunking the myths
bullldquoI donrsquot need separation because I donrsquot have a designerrdquo
bullldquoYou cannot use MVVM with other patternsrdquo
bullldquoMVVM will make you rich and attractiverdquo
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
DEMO
MVVM on theWindows Phone 7
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion
THANKS
httpbloggalasoftch
httpwwwgalasoftchmvvmgetstarted
LBugnion