Is there a way to find out if DependencyProperty is related to source or target binding?

Sometimes I want to know if the value of the dependency property was entered from user input or from a change in the binding source. I have not yet found a clean way to determine this.

There are things like DependencyPropertyHelper , but this does not help in this scenario, as far as I can tell.

Scenario: <TextBox Text="{Binding Foo}" />

Find out if it was the source of the binding or the Textlast updated target . Or something else, yes, I know triggers, inheritance animations, etc.

+4
source share
1 answer

, , , :

BindingOperations.GetBindingExpressionBase(textBox, TextBox.TextProperty)?.Status == 
    BindingStatus.Active

DependencyPropertyHelper, , BaseValueSource.Local.

ValueSource IsExpression, true , DynamicResource TemplateBinding.

, , . AFAIK , :

<TextBox Text="{Binding Path=Foo, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}"
         SourceUpdated="OnSourceUpdated" TargetUpdated="OnTargetUpdated" />

OnSourceUpdated OnTargetUpdated . .

+2

All Articles