【Tips】建立OnPropertyChanged。其中的方法簽章若沒有寫入,則預設為呼叫的成員名稱


Sep 02, 2022
using System.ComponentModel;
using System.Runtime.CompilerServices;
public class MyDataContext : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    public void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        //Console.WriteLine($"MyDataContext:OnPropertyChanged__{propertyName}");
    }
}
#wpf






你可能感興趣的文章

去除陣列中的黑名單(以物件屬性檢查)

去除陣列中的黑名單(以物件屬性檢查)

解構賦值 Destructuring Assignment

解構賦值 Destructuring Assignment

Select Sort

Select Sort






留言討論






2
2
2