/// <summary>Removes the binding from a property if there is one.</summary> /// <param name="target">The object from which to remove the binding.</param> /// <param name="dp">The dependency property from which to remove the binding.</param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="target" /> and <paramref name="dp" /> parameters cannot be <see langword="null" />.</exception> // Token: 0x06001A33 RID: 6707 RVA: 0x0007D1AC File Offset: 0x0007B3AC public static void ClearBinding(DependencyObject target, DependencyProperty dp) { if (target == null) { throw new ArgumentNullException("target"); } if (dp == null) { throw new ArgumentNullException("dp"); } if (BindingOperations.IsDataBound(target, dp)) { target.ClearValue(dp); } }
/// <summary>Removes all bindings, including bindings of type <see cref="T:System.Windows.Data.Binding" />, <see cref="T:System.Windows.Data.MultiBinding" />, and <see cref="T:System.Windows.Data.PriorityBinding" />, from the specified <see cref="T:System.Windows.DependencyObject" />.</summary> /// <param name="target">The object from which to remove bindings.</param> /// <exception cref="T:System.ArgumentNullException">If <paramref name="target" /> is <see langword="null" />.</exception> // Token: 0x06001A34 RID: 6708 RVA: 0x0007D1DC File Offset: 0x0007B3DC public static void ClearAllBindings(DependencyObject target) { if (target == null) { throw new ArgumentNullException("target"); } LocalValueEnumerator localValueEnumerator = target.GetLocalValueEnumerator(); ArrayList arrayList = new ArrayList(8); while (localValueEnumerator.MoveNext()) { LocalValueEntry localValueEntry = localValueEnumerator.Current; if (BindingOperations.IsDataBound(target, localValueEntry.Property)) { arrayList.Add(localValueEntry.Property); } } for (int i = 0; i < arrayList.Count; i++) { target.ClearValue((DependencyProperty)arrayList[i]); } }