RaisePropertyChanged should not raise event for string.Empty


To raise all PropertyChanged Events of a ViewModel in one time I can use string.Empty for the property name in PropertyChangedEventArgs.
Since I use GalaSoft.MvvmLight.ViewModelBase.RaisePropertyChanged of MVVM Light, I get the runtime error: Message=Property not found ParamName="" Source=GalaSoft.MvvmLight.WPF4 This is because MVVM Light check all Property-Names.

I would prefer to change VerifyPropertyName in ViewModelBase
to something like this code:
    /// <summary>
    /// Verifies that a property name exists in this ViewModel. This method
    /// can be called before the property is used, for instance before
    /// calling RaisePropertyChanged. It avoids errors when a property name
    /// is changed but some places are missed.
    /// <para>This method is only active in DEBUG mode.</para>
    /// </summary>
    /// <param name="propertyName"></param>
    public void VerifyPropertyName(string propertyName)
        var myType = this.GetType();
        if propertyName <> String.empty
            if (myType.GetProperty(propertyName) == null)
                throw new ArgumentException("Property not found", propertyName);
I think this is a common issue.

Thanks Peter
Closed Oct 13, 2014 at 1:53 PM by lbugnion