This documentation is archived and is not being maintained.

BindingOperations.ClearAllBindings Method

Removes all bindings, including bindings of type Binding, MultiBinding, and PriorityBinding, from the specified DependencyObject.

Namespace:  System.Windows.Data
Assembly:  PresentationFramework (in PresentationFramework.dll)

public static void ClearAllBindings(
	DependencyObject target
)
You cannot use methods in XAML.

Parameters

target
Type: System.Windows.DependencyObject

The object from which to remove bindings.

ExceptionCondition
ArgumentNullException

If target is null.

If the specified object is not data-bound, this method has no effect.

This example shows how to clear bindings from an object.

To clear a binding from an individual property on an object, call ClearBinding as shown in the following example. The following example removes the binding from the TextProperty of mytext, a TextBlock object.

BindingOperations.ClearBinding(myText, TextBlock.TextProperty);

Clearing the binding removes the binding so that the value of the dependency property is changed to whatever it would have been without the binding. This value could be a default value, an inherited value, or a value from a data template binding.

To clear bindings from all possible properties on an object, use ClearAllBindings.

For the complete example, see Creating a Binding in Code Sample.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Show: