Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I detect binding changes in Silverlight?

Is there a way to detect when a binding is changed? I'm not asking about the value, I mean the binding expression itself.

like image 780
Jonathan Allen Avatar asked Aug 25 '11 00:08

Jonathan Allen


1 Answers

The only way I can imagine doing this would be to track the BindingExpression whenever the property changes. The property callback ought to fire when the binding is changed. In call back use GetBindingExpression to retrieve and store a reference to the current BindingExpression.

With each callback execution check whether the current reference held is the same reference returned by GetBindingExpression, if not the binding has been changed.

This only works on a FrameworkElement derivative though, I can't think of a way to do this on a UIElement or raw DependencyObject.

like image 102
AnthonyWJones Avatar answered Sep 21 '22 14:09

AnthonyWJones