I've got a viewmodel that implements the INotifyDataErrorInfo interface.
When a property is updated and a validation error occurs, I call the ErrorsChanged event, the binding engine then knows it has to call the GetErrors(string propertyName) method on my viewmodel, and from there I return the IEnumerable of errors for the corresponding propertyName.
Nothing special.
But when I was debugging, it seems to be that the GetErrors() method is called when a viewmodel property changes (on invoking INotifyPropertyChanged.PropertyChanged of course). Even while my viewmodel didn't invoke ErrorsChanged.
Does the binding engine call GetErrors() on its own when a property change is notified? (And thus not only when my viewmodel explicitly invokes ErrorsChanged?)
I can't find it in the docs.
Yes. The
TransferValuemethod, which eventually get called when you raise aPropertyChangedevent for a UI bound source property, in theBindingExpressionclass callsUpdateNotifyDataErrorsas you can see in the source code.