MVVM – Model-View-ViewModel

 
 
  • Gérald Barré

The Model View ViewModel (MVVM) is an architectural model from Microsoft used in WPF applications. Mostly based on the Model-View-Controller (MVC) model, MVVM is for Windows Presentation Foundation (WPF) and Silverlight in which there is a user experience (UX) that has requirements different from the more "traditional" development.

MVVM was designed to use specific functions in WPF to almost remove all of the "code-behind" from the view. The code behind will be in the view model, but in a generic way. I mean, you don't code a Button_Click method in the view model, but a Save method. Then you'll bind the button (or something else) to the Save method. So, instead of requiring designers to write code, they can use XAML and create links to the ViewModel that is written and maintained by the application developers. This separation of roles allows designers to focus on UX rather than programming logic.

Rather than spending too much time explaining to you, I advise you this Josh Smith article: WPF Apps With The Model-View-ViewModel Design Pattern.

In the same vein, I also recommend this video of Jason Dolinger, in which he explains what the MVVM pattern is and how to develop and test a WPF application by using it.

A very complete article in French written by Olivier Dahan: https://www.e-naxos.com/Blog/post/Appliquer-la-pattern-MVVM-avec-MVVM-Light.aspx

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee💖 Sponsor on GitHub