views:

584

answers:

1

How do you Clear/Remove DataBinding in Silverlight?

similar to: http://stackoverflow.com/questions/186475/remove-binding-in-wpf-using-code

But the BindingOperations.ClearBinding() method does not exist in Silverlight 3.

+1  A: 

The BindingOperations.ClearBinding() method calls ClearValue() internally.

public static void ClearBinding(DependencyObject target, DependencyProperty dp)
{
    if (target == null)
    {
        throw new ArgumentNullException("target");
    }
    if (dp == null)
    {
        throw new ArgumentNullException("dp");
    }
    if (IsDataBound(target, dp))
    {
        target.ClearValue(dp);
    }
}

via Reflector.

Aaron Hoffman