开发者

PropertyChanged for all Properties: Message=Property not found

开发者 https://www.devze.com 2023-01-12 16:17 出处:网络
I want to raise PropertyChanged for all 20 Properties of my ViewModel in once and get the solution: RaisePropertyChanged(String.Empty)

I want to raise PropertyChanged for all 20 Properties of my ViewModel in once and get the solution:

RaisePropertyChanged(String.Empty)

see: C#/WPF: PropertyChanged for all Properties in ViewModel?

Since I use GalaSoft.MvvmLight.ViewModelBase.RaisePropertyChanged of MVVM Light, I get the runtime error:

   Message=Property not found
   ParamName=""
   Source=GalaSoft.MvvmLight.WPF4
开发者_JAVA技巧

This is because MVVM Light check all Property-Names.

What can I do?


If you look at the source, you'll see that this exception is only raised when you're compiling as DEBUG. If you compile as RELEASE you won't get this behavior anymore.

Like Kent said, I changed the source to do a Debug.Writeline instead of throwing an exception. I don't like the default behavior, especially since I will commonly re-raise PropertyChanged to a parent ViewModel from a list of child ViewModels.


You could file a bug report and, in the meantime, change MVVM Light yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号