130 likes | 449 Views
Model View View-Model Introduction to the MVVM Pattern. Binu Bhasuran Microsoft MVP Visual C# Facebook http://facebook.com/codeno47 Blog http://proxdev.com/. Introduction. What is a MVVM? How it is important to software development?. The Evolution of Model-View-ViewModel.
E N D
Model View View-ModelIntroduction to the MVVM Pattern Binu Bhasuran Microsoft MVP Visual C# Facebookhttp://facebook.com/codeno47 Blog http://proxdev.com/
Introduction • What is a MVVM? • How it is important to software development?
The Evolution of Model-View-ViewModel • The Model-View-Presenter (MVP) pattern has enjoyed popularity on various UI programming platforms. • MVP is a variation of the Model-View-Controller pattern, which has been around for decades.
The Evolution of Model-View-ViewModel • Martin Fowler published an article about a pattern named Presentation Model (PM). • John Gossman, currently one of the WPF and Silverlight Architects at Microsoft, unveiled the Model-View-ViewModel (MVVM) pattern
Why MVVM ? • The single most important aspect of WPF that makes MVVM a great pattern to use is the data binding infrastructure. • Entirely remove the need for writing code in a ViewModel that directly updates a view. • Can easily write code that tests • Visual designers, using MVVM makes it much easier to create a smooth designer/developer workflow.
Relaying Command Logic • ICommandobjects exposed by the ViewModelexecute. • When a ViewModel exposes an instance property of type ICommand, the command object typically uses that ViewModel object to get its job done. • RelayCommand is a simplified variation of the DelegateCommand
ViewModel Class Hierarchy • Implements the INotifyPropertyChangedinterface.