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.
精彩评论