Understanding of MVVM architecture


The purpose of using MVVM architecture

1: In order to make the development fast, interface design and interface interaction can be carried out at the same time.

2: In order to facilitate the test, the test of interactive function can be completely separated from WPF control.


The architecture of WPF MVVM is as follows:




In WPF, after the V interface data is changed, modify m directly, so that VM can get the latest value from m directly. When the V interface triggers events such as (save, modify, etc.), VM can directly save the value from M.



Web MVVM architecture description





In web, the data of V interface is saved to m after being changed. Only after the event is triggered in the V interface can the m value be transferred to the VM. The VM operates on the data and returns the corresponding M and V.