How to write a ViewModelBase in MVVM

前端 未结 5 727
孤街浪徒
孤街浪徒 2020-12-02 07:32

I\'m pretty new in WPF programming environment. I\'m trying to write a program out using MVVM design pattern.

I\'ve did some studies and read up some articles relate

5条回答
  •  感动是毒
    2020-12-02 07:55

    In most MVVM frameworks, the base ViewModel classes actually contain very little code - usually just an implementation of INotifyPropertyChanged and some helper functions.

    Take a look at the source code for MVVM Light's ViewModelBase and ObservableObject classes. ObservableObject is mostly the INotifyPropertyChanged implementation - using a lambda expression rather than "magic strings" for the property name. ViewModelBase extends ObservableObject and is mostly a utility method to determine if you're running inside the Visual Studio designer

提交回复
热议问题