0% found this document useful (0 votes)
40 views7 pages

MVVM

The MVVM pattern separates an application into three main parts: the model, the view, and the view model. The model manages the data, the view displays the UI and binds to the view model, and the view model exposes the model's data and handles user input as commands to maintain separation of concerns and enable testability. MVVM aims to reduce code behind, support separation of designer and developer roles, and take advantage of data binding between the view and view model.

Uploaded by

CHANDANA RAYUDU
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views7 pages

MVVM

The MVVM pattern separates an application into three main parts: the model, the view, and the view model. The model manages the data, the view displays the UI and binds to the view model, and the view model exposes the model's data and handles user input as commands to maintain separation of concerns and enable testability. MVVM aims to reduce code behind, support separation of designer and developer roles, and take advantage of data binding between the view and view model.

Uploaded by

CHANDANA RAYUDU
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

MVVM

Design Patterns
Collaboration
• Model
• The Data
• View
• Binding to ViewModel set by the DataContext
• ViewModel
• Exposes the Model as Properties and Commands
• Must implement INotifyPropertyChanged
Advantages of MVVM
• Reduce code-behind
• Model does not need to change to support a view
• Designers design, developers code
• Reduces development time
• Multi-targeting
Disadvantages of MVVM
• Create more files/classes
• Simple tasks can be complicated
• Lack of standardization
• Specific to WPF and Silverlight
MVVM
• 2004 – Martin Fowler – Presentation Model
• Separate a view from its state and behavior
• Not dependent on a specific UI framework
• 2008 – John Gossman – MVVM
• Identical to PM pattern
• Dependent on WPF/Silverlight
Intent of MVVM
• Separate Concerns
• UI (View)
• View’s state and behavior (ViewModel)
• Data (Model)
• Unit Testing and UI Testing
• Maintenance
• Extensibility
• Enable the designer/developer workflow
• Take advantage of data binding
Structure of MVVM
• View
• May or may not have a reference to the ViewModel
• Does NOT have a reference to the Model
• ViewModel
• Has a reference to the Model
• May or may not have a reference to the View
• Model
• Has no references to the View or ViewModel

You might also like