Files
docs-desktop/dotnet-desktop-guide/framework/wpf/data/how-to-clear-bindings.md
T
Andy (Steve) De George e9fcf43083 Merge pull request #1135 from dotnet/adegeo-links
Correct .NET Framework links that pointed to old .NET 5 URLs
2021-08-11 12:04:34 -07:00

1.5 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Clear Bindings 03/30/2017
csharp
vb
bindings [WPF], clearing
clearing bindings [WPF]
data binding [WPF], clearing bindings
73962a93-32a9-4bcd-9240-bcfbb239093a

How to: Clear Bindings

This example shows how to clear bindings from an object.

Example

To clear a binding from an individual property on an object, call xref:System.Windows.Data.BindingOperations.ClearBinding%2A as shown in the following example. The following example removes the binding from the xref:System.Windows.Controls.TextBlock.TextProperty of mytext, a xref:System.Windows.Controls.TextBlock object.

[!code-csharpCodeOnlyBinding#ClearBinding] [!code-vbCodeOnlyBinding#ClearBinding]

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 xref:System.Windows.Data.BindingOperations.ClearAllBindings%2A.

See also