2016-03-08 51 views
2

创建WinForm的项目目标.NET 4.5.1如何订阅PropertyChange事件与Fody-的PropertyChanged

安装,包装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? 

回答

2

我想这是迟到了,但当然可以。就在这个事件添加到您的类:

public event PropertyChangedEventHandler PropertyChanged; 

Fody会认识到你的IPropertyChanged接口和电线所有属性正确的事件来触发事件。