Distinguishing PropertyChange event source properties

Apr 2, 2013 at 6:32 PM
Wouldn't it be helpful if BindableBase had a method to check if a PropertyChange event is coming from a specific property like:
private void MyViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
{
    if (this.MyViewModel.IsPropertyChangedForProperty(e, () => this.MyViewModel.MyProperty))
    {
        ...
    }
}

/// <summary>
/// Checks whether the PropertyChanged event for the given args was raised for the given property.
/// </summary>
/// <param name="e">
/// The PropertyChanged event arguments.
/// </param>
/// <param name="propertyLambdaExpression">a lambda expression from a property created
/// using the form "() => property" e.g. GetPropertyBinding(() => CanDoSomething);</param>
/// <typeparam name="T">The type of the property</typeparam>
/// <returns>
/// True if the PropertyChange event was raised for the property specified with the given lambda expression.
/// </returns>
public bool IsPropertyChangedForProperty<T>(PropertyChangedEventArgs e, Expression<Func<T>> propertyLambdaExpression)
{
    return e.PropertyName == GetPropertyName(propertyLambdaExpression);
}
This would use the old Prism-style property name extraction that is refactoring-safe.

Would that be a good pattern, or would it be better to create a custom event for each property that you would want to handle change event from in the code?