Tuesday, May 29, 2012

Model-View-ViewModel Pattern (MVVM)


I strongly suggest before writing your first WPF application - learn MVVM and try to understand what it stands for. Believe me, it will save a lot of time for you in the end. Moreover I would say every WPF application must implement MVVM pattern. Let's figure out what MVVM actually is.

The Model-View-ViewModel (MVVM) is a typical WPF Design Pattern. Its main purpose is to separate GUI elements, GUI logic, business objects and business logic one from another.

MVVM Diagram


  • View gets all the user input and transfers it to  the ViewModel, usually by commands
  • The View connected to the ViewModel by using data binding
  • The Model does not know about the ViewModel

MVVM Description

I attached below the source code of a really good MVVM example, check it out.
Download example source code - (Visual Studio 2008 Project)

No comments:

Post a Comment

Post a Comment