zoukankan      html  css  js  c++  java
  • 属性改变后通知关注者

     public class NotifyPropertyChanged : INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler PropertyChanged;

            protected void RaisePropertyChanged(string PropertyName)
            {
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(PropertyName));
            }

            protected void OnPropertyChanged([CallerMemberName] string PropertyName = null)
            {
                RaisePropertyChanged(PropertyName);
            }


            protected void RaiseAllChanged()
            {
                RaisePropertyChanged("");
            }

            protected bool Set<T>(ref T Field, T Value, [CallerMemberName] string PropertyName = null)
            {
                if (EqualityComparer<T>.Default.Equals(Field, Value))
                    return false;

                Field = Value;

                RaisePropertyChanged(PropertyName);

                return true;
            }
        }

  • 相关阅读:
    c++ new 堆 栈
    c++ int 负数 补码 隐式类型转换
    python json 序列化
    %pylab ipython 中文
    matplotlib中什么是后端
    IPython 4.0发布:Jupyter和IPython分离后的首个版本
    ipython
    python 类
    python 高级特性
    windows网络模型
  • 原文地址:https://www.cnblogs.com/cnhk19/p/11926723.html
Copyright © 2011-2022 走看看