Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

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
)
public static void ClearAllBindings (
	DependencyObject target
)
public static function ClearAllBindings (
	target : DependencyObject
)
You cannot use methods in XAML.

Parameters

target

The object from which to remove bindings.

Exception typeCondition

ArgumentNullException

If target is a null reference (Nothing in Visual Basic).

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 Code-only Binding Sample.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)

Community Additions

© 2013 Microsoft. All rights reserved.