Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear Binding in Silverlight (Remove Data Binding from SetBinding)

How do you Clear/Remove DataBinding in Silverlight?

similar to: Remove binding in WPF using code

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

like image 452
Aaron Hoffman Avatar asked Oct 28 '09 18:10

Aaron Hoffman


1 Answers

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.

like image 132
Aaron Hoffman Avatar answered Oct 16 '22 02:10

Aaron Hoffman