在Windows Phone 8.1 RT的弱模式下监听属性更改事件

时间:2015-02-26 12:25:21

标签: c# windows xaml windows-phone-8.1

我有以下对象:

public class EventCounter : INotifyPropertyChanged
{
    private int _count = 0;
    public int Count {
        get
        {
            return _count;
        }
        set
        {
            _count = value;
            NotifyPropertyChanged("Count");
        }
    }


    public event PropertyChangedEventHandler PropertyChanged;

    public void NotifyPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this,
                new PropertyChangedEventArgs(propertyName));
        }
    }
}

我希望每次使用"弱事件模式更改计数值时都会收到通知"

我该怎么做?

0 个答案:

没有答案