This project has moved and is read-only. For the latest updates, please go here.
2

Closed

The RaisePropertyChanged Overloads Contain Duplicate Code

description

The two overloads of the RaisePropertyChanged method in the ObservableObject class should funnel into a single common virtual method, instead of duplicating event code inside of each.

This will make overriding the virtual method easier, and will reduce the number of code changes needed if we - for instance - enhance the method in the future.

Proposed fix:

protected virtual void RaisePropertyChanged(string propertyName)
{
VerifyPropertyName(propertyName);
var handler = PropertyChanged;
if (handler != null)
{
    handler(this, new PropertyChangedEventArgs(propertyName));
}
}

protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
{
if (propertyExpression == null)
{
    return;
}
var body = propertyExpression.Body as MemberExpression;
if(body != null)
{
    RaisePropertyChanged(body.Member.Name);
}
}
Closed Jul 20, 2016 at 9:05 AM by lbugnion
Fixed in V5.3.0

comments

lbugnion wrote Jan 17, 2016 at 8:20 PM

Resolved in V5.3. Will close the issue when this is version is released.