1.

What do you mean by MVVM (Model View ViewModel)?

Answer»

MVVM (Model-View-ViewModel) is a pattern that is used extensively by the Windows Presentation Framework (WPF) for building applications. MVVM is not mandatory to create WPF applications, but knowing about it can simplify the process of building WPF applications. This method allows developers and designers to work together without a great deal of technical difficulty by utilizing the capabilities of the WPF platform. There are three main components of MVVM as shown below: 

  • View: Views represent the user interface components of WPF applications written in XAML. A number of controls are available, including user controls, buttons, and labels. There are also resources such as CONTROLTEMPLATE, DataTemplate, and Styles. Although the view may be entirely code-based, XAML will (and should) be used for a large proportion of the UI.
  • Model: In general, the model provides your application with the data it needs. Models implement the model for an application domain and also include business objects, validations, and backend objects for retrieving and storing data.
  • View Model: It is the interface between Views and Models, handling Presentation Logic as well as retrieving/saving data from the Models. In other words, it's an abstraction of a view in the application. ViewModels contain the logic that MANIPULATES the raw data so that it is displayed in views.

By calling the public methods in the Model classes, the ViewModel interacts with the Model. Model data is collected and sent to the View. Using WPF's data-binding and COMMAND features, the View interacts with the ViewModel. The ViewModel implements commands that are EXECUTED whenever a user interacts with the view. 



Discussion

No Comment Found