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


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






你可能感興趣的文章

2017,讓我們再來看看 Web Components 吧!

2017,讓我們再來看看 Web Components 吧!

React-[串接api篇]-註冊功能發送post ajax call

React-[串接api篇]-註冊功能發送post ajax call

[Release Notes] 20210317_v1 - Support Insert img path and save button in post editor

[Release Notes] 20210317_v1 - Support Insert img path and save button in post editor






留言討論