NotifyPropertyChanged with parameter name string.Empty

Aug 5, 2011 at 8:01 AM

Hi,

you can update all the UI property bindings of a view model at once by giving string.Empty or null as property name. See:

http://jobijoy.blogspot.com/2009/07/easy-way-to-update-all-ui-property.html

If I do so with the latest version of the Cinch V2 framework, I'm getting an assertion failure from the VerifypropertyName method of the ViewModelBase class: "Invalid property name".

Is that the intended behaviour?

 

Regards

Andreas

Aug 7, 2011 at 6:44 PM

Yes that is the intended behaviour, that is in the Cinch ViewModelBase class, there is something in there that will throw Exception. If you do not like that copy my ViewModelBase class and remove that bit of code.

Aug 8, 2011 at 7:35 AM

Hey if you want that behaaviour there is an easy way, simple override this virtual property from Cinch ViewModelBase class in your own ViewModels

 

protected virtual bool ThrowOnInvalidPropertyName { get; private set; }

 

Just get it to return false, and no more Exceptions will be thrown if you pass empty string