MVVM - RaisePropertyChanged turning code into a mess

前端 未结 5 1988
萌比男神i
萌比男神i 2021-01-12 00:08

New to MVVM so please excuse my ignorance.

I THINK i\'m using it right but I find my ViewModel has too many of these:

RaisePropertyChanged(\"SomeProp         


        
5条回答
  •  生来不讨喜
    2021-01-12 00:30

    It helps to look at things from a different perspective: those are not complicated .NET properties, but simplified dependency properties.

    Bindable properties of a view model in WPF are not identical to .NET properties, instead it is a kind of key-value store. If you want light-weight alternative to DependencyObject, you have an ability to implement this key-value store just buy calling certain function in setters - not bad, actually. Far from ideal too, of course, but your point of view is certainly unfair.

提交回复
热议问题