in Education by
How can you explain view and view model in MVVM?

1 Answer

0 votes
by
The View is the client interface, input-output interface or the user interface. It collects all the user interface elements of the window, navigation page, user control, resource file, style and themes, custom tools and controls. The view is unaware of the ViewModel and the Model, and vice versa the ViewModel and Model is unaware of the View and control is tightly decoupled.
 
But the view model is aware of the needs of the view. They communicate by data binding and a dependency property or properties.
 
ViewModel in MVVM
 
ViewModel is a non-visual class. The MVVM Design Pattern does not derive from any WPF or Silverlight based class. The ViewModel is unaware of the view directly. Communication between the View and ViewModel is through some property and binding. Models are connected directly to the ViewModel and invoke a method by the model class, it knows what the model has, like properties, methods etcetera and also is aware of what the view needs.
 
One View-Model can connect to multiple models, work like a one-to-many relationship and encapsulate business logic and data for the View. A ViewModel inherits some interface like INotifyPropertyChangedicommand INotifyCollectionChanged etcetera.
 
ViewModel

Related questions

0 votes
    What is WPF Dependency Property and how can we use?...
asked Apr 9, 2021 in Education by JackTerrance
0 votes
    How can we create Borderless Window in WPF?...
asked Apr 9, 2021 in Education by JackTerrance
0 votes
    What is Attached Properties and how to register it?...
asked Apr 9, 2021 in Education by JackTerrance
0 votes
    What is Trigger and how many types of triggers in WPF?...
asked Apr 8, 2021 in Education by JackTerrance
0 votes
    How does “UpdateSourceTrigger” affect bindings?...
asked Apr 9, 2021 in Education by JackTerrance
0 votes
0 votes
    What is the difference between Static and Dynamic resources?...
asked Apr 9, 2021 in Education by JackTerrance
0 votes
    What is Command Design Pattern and ICommand in WPF?...
asked Apr 8, 2021 in Education by JackTerrance
0 votes
    What are static and dynamic resources?...
asked Apr 8, 2021 in Education by JackTerrance
...