Catel.Fody and computed read-only property change notifications

This post originally comes from the blog of Igr Alexánder Fernández Saúco, one of the members of the Catel development team

As you probably know by now, Catel.Fody will rewrite all properties on the ModelBase and ViewModelBase. So, if a property is written as this:

public string FirstName { get; set; }

it will be weaved into

public string FirstName
{
    get { return GetValue<string>(FirstNameProperty); }
    set { SetValue(FirstNameProperty, value); }
}

public static readonly PropertyData FirstNameProperty = RegisterProperty("FirstName", typeof(string));

But now we added a new feature to Catel.Fody. If a read-only computed property like this one exists:

public string FullName
{
    get { return string.Format("{0} {1}", FirstName, LastName).Trim(); }
}

the OnPropertyChanged method will be also weaved into

protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e)
{
    base.OnPropertyChanged(e);

    if (e.PropertyName.Equals("FirstName"))
    {
        base.RaisePropertyChanged("FullName");
    }

    if (e.PropertyName.Equals("LastName"))
    {
        base.RaisePropertyChanged("FullName");
    }
}

This feature is already available in the latest beta package of Catel.Fody. Try it for yourself and let us know.