zoukankan      html  css  js  c++  java
  • MVVM WPF 简化 类的开发

    https://www.cnblogs.com/li-peng/p/3169864.html

    https://www.cnblogs.com/ColdJokeLife/archive/2013/05/30/3108112.html

    //C#5.0 版本
    public abstract class ObservableObject : INotifyPropertyChanged
     {
            public event PropertyChangedEventHandler PropertyChanged;
    protected void SetProperty<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
            {
                if (EqualityComparer<T>.Default.Equals(field, value))
                {
                    return;
                }

                field = value;
                var handler = this.PropertyChanged;
                if (handler != null)
                {
                    handler(this, new PropertyChangedEventArgs(propertyName));
                }
            }
    }

    public class Person : NotifyPropertyChangedEx
    {
        private string name;
    
        public string Name
        {
           get { return name; }
           set { this.SetProperty(ref name, value); }
        }
  • 相关阅读:
    Python基础学习笔记(10)形参 命名空间
    10 练习题:形参 命名空间
    09 练习题:函数、参数
    4.题库
    第三章:构造NFA DFA
    第二章
    第一章
    83.jquery的筛选与过滤
    82.认识jQuery以及选择器
    81.案例 初始化、拖拽、缓冲
  • 原文地址:https://www.cnblogs.com/DotNet1010/p/12887226.html
Copyright © 2011-2022 走看看