wpf mvvm confusion

后端 未结 5 1555
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 08:34

as per my understanding about mvvm is.

there is a model (entity class that also implement inotify...), view (xaml code) and some class as vm (kind of controller whi

5条回答
  •  梦谈多话
    2021-01-14 08:55

    First, for MVVM purposes you don't need the VM to inherit ICommand. Instead, VM contains a set of properties of type inherited from ICommand. So that View just binds to those properties. F.i.:

    And code-behind isn't used because it's basically inseparable part of the View. It's the same class your View is. You can't easily test it, and your code is often tightly coupled to the XAML.

    And Model is not really obliged to (but can) support INotifyPropertyChanged. Whereas ViewModel should of course implement this interface to allow binding.

    I suggest you to read a few introducing articles on the subject. It's not that confusing. This can be the first one: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

提交回复
热议问题