红糖泡枸杞WPF⾃定义NotifyPropertyChanged 该⼯具类实现INotifyPropertyChanged接⼝
///<summary>
///实现了属性更改通知的基类
///</summary>
public class BaNotifyPropertyChanged : System.ComponentModel.INotifyPropertyChanged
{
///<summary>
///属性值变化时发⽣
///</summary>
///<param name="propertyName"></param>
protected virtual void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
土工织物this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}黑芝麻糊怎么做
///<summary>
///属性值变化时发⽣炒肉的做法
///</summary>
///<param name="propertyName"></param>
protected virtual void OnPropertyChanged<T>(Expression<Func<T>> propertyExpression)
树叶贴画{
一二墙var propertyName = (propertyExpression.Body as MemberExpression).Member.Name;
中医药大学排名
this.OnPropertyChanged(propertyName);
}
public virtual event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
算命手相
}
View Code
使⽤时继承此类,然后在VM中的属性get使⽤:OnPropertyChanged(()=>PropertyName)