Hello,
If you want to re-write the OnPropertyChanged in the ObservableObject.
This OnPropertyChanged(PropertyChangedEventArgs e) is virtual method, you need to add **override **in it and If you want to fire OnPropertyChanged method when value of property changed, you have to invoke the ObservableObject.OnPropertyChanged method by base.OnPropertyChanged(e);
.
You can refer to the following code.
public partial class MyViewModel: ObservableObject
{
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
{
ArgumentNullException.ThrowIfNull(e);
base.OnPropertyChanged(e);
}
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.