J
J
Just0x322021-12-03 17:24:29
WPF
Just0x32, 2021-12-03 17:24:29

Why is PropertyChanged not always null?

Standard implementation of the PropertyChanged event and its call method:

public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
    if (PropertyChanged != null)
    {
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}

Accordingly, the event must be raised when the NotifyPropertyChanged method is called from somewhere.

Why is PropertyChanged not always null in such a check ?
Where is the subscription to the event?
For example, like this:

PropertyChanged += {какой-то метод};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Just0x32, 2021-12-03
@Jalui

The answer is in the comments.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question