【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






你可能感興趣的文章

不可不知的小工具-string.Length

不可不知的小工具-string.Length

11. Facade

11. Facade

一起來看 Joshua B. Tenenbaum 教授有趣的認知科學研究 - Building Machines that Learn and Think Like People

一起來看 Joshua B. Tenenbaum 教授有趣的認知科學研究 - Building Machines that Learn and Think Like People






留言討論






2
2
2