Search code examples
silverlightdata-bindingbinding-expressions

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.


Solution

  • 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.