Clear Binding in Silverlight (Remove Data Binding from SetBinding)

前端 未结 1 1422
北海茫月
北海茫月 2020-12-06 05:42

How do you Clear/Remove DataBinding in Silverlight?

similar to: Remove binding in WPF using code

But the BindingOperations.ClearBinding() method does not exi

相关标签:
1条回答
  • 2020-12-06 06:08

    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.

    0 讨论(0)
提交回复
热议问题