Watson
Watson

Reputation: 1425

How to subscribe to PropertyChange event with Fody-propertychanged

Create winform project targeting .net 4.5.1

Install-Package PropertyChanged.Fody

[ImplementPropertyChanged]
public class PersonFody
{
    public string Name { get; set; }
}

PersonFody _fod = new PersonFody();

_fod. //Name is the only property and no events to subscribe

Is it possible to subscribe to a PropertyChanged event at design time using fody?

Upvotes: 2

Views: 589

Answers (1)

Greg
Greg

Reputation: 1629

I guess this is late, but yes you can. Just add this event to your class:

public event PropertyChangedEventHandler PropertyChanged;

Fody will recognize you have the correct event for the IPropertyChanged interface and wire all your properties to trigger that event.

Upvotes: 5

Related Questions