Home > Back-end >  In WPF, why should the NotifyOnSourceUpdated option ever be false?
In WPF, why should the NotifyOnSourceUpdated option ever be false?

Time:01-25

When setting up a binding in WPF, what is the use case for telling the bound control to NOT update when its source property is updated? If that's your desired behavior, why use binding at all? In other words, why does WPF have a NotifyOnSourceUpdated property for bindings, or at the very least, why does it default to False?

CodePudding user response:

There are use cases such as not updating the UI when there are custom workflows. Sometimes you want to control on when to validate the forms and show the validation error at a later time.

CodePudding user response:

what is the use case for telling the bound control to NOT update when its source property is updated?

This is a misconception.

The property does not control whether a Binding is triggered when the source property has changed. This is not something you can turn off.

Instead, the NotifyOnSourceUpdated property

Gets or sets a value that indicates whether to raise the SourceUpdated event when a value is transferred from the binding target to the binding source.

which just controls whether it fires its SourceUpdated event, to which application code may attach an event handler, e.g. for monitoring.


There is an equivalent property and event for the other data flow direction, NotifyOnTargetUpdated and TargetUpdated.

  •  Tags:  
  • Related