How can I listen for changes to sub-property using PropertyChanged.Fody?

679 views Asked by At

I use the awesome weaver PropertyChanged.Fody for avoiding INotifyPropertyChanged boilerplate. I define dependent properties like this:

public string FirstName { get; set; }
public string LastName { get; set; }
public string FullName { get { return FirstName + " " + LastName; } }

However, this method does not work with subproperties. What I want to achieve is something like this:

public Person MyChild { get; set; }
public string ChildName { get { return MyChild.FullName } }

When MyChild.FirstName changes, I want ChildName to notify that it is also changed. Is is possible to achieve this without explicitly subscribing to MyChild.PropertyChanged and manually calling RaisePropertyChanged("ChildName")?

0

There are 0 answers