Thursday 12 January 2017

A Simple Implementation of MVVM Pattern in WPF Application

mvvm.png

In this article we are going to see simple implementation of MVVM pattern in WPF application. First create a WPF application and name it as "SimpleMVVMApp" and add the three folders (Model, ViewModel, and Views) into your project, after which our application will look as shown in the following screenshot.

Let's understand this MVVM architecture while adding components of MVVM in following steps:


  1. Model - This folder will contain simple class objects that will represent actual data in the application. They shouldn't be containing any data manipulation logic, event handling, business logic or any of that stuff. An example of a model could be a Person entity having first name, last name, age etc.
  2. ViewModel - The ViewModel might consist of Commands, properties that are being reflected in the view. Commands will basically handle the events from the view and properties could be a collection of object or a single object.

No comments:

Post a Comment