Skip to main content
Binding Class
 

Provides high-level access to the definition of a binding, which connects the properties of binding target objects (typically, WPF elements), and any data source (for example, a database, an XML file, or any object that contains data).

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


public class Binding : BindingBase
public ref class Binding : BindingBase
type Binding = 
    class
        inherit BindingBase
    end
Public Class Binding
	Inherits BindingBase
NameDescription
System_CAPS_pubmethod Binding

Initializes a new instance of the Binding class.

System_CAPS_pubmethod Binding

Initializes a new instance of the Binding class with an initial path.

NameDescription
System_CAPS_pubproperty

This API supports the product infrastructure and is not intended to be used directly from your code. Gets or sets opaque data passed to the asynchronous data dispatcher.

System_CAPS_pubproperty

Gets or sets the name of the BindingGroup to which this binding belongs.(Inherited from BindingBase.)

System_CAPS_pubproperty

Gets or sets a value that indicates whether to evaluate the relative to the data item or the DataSourceProvider object.

System_CAPS_pubproperty

Gets or sets the converter to use.

System_CAPS_pubproperty

Gets or sets the culture in which to evaluate the converter.

System_CAPS_pubproperty

Gets or sets the parameter to pass to the .

System_CAPS_pubproperty

Gets or sets the amount of time, in milliseconds, to wait before updating the binding source after the value on the target changes.(Inherited from BindingBase.)

System_CAPS_pubproperty

Gets or sets the name of the element to use as the binding source object.

System_CAPS_pubproperty

Gets or sets the value to use when the binding is unable to return a value.(Inherited from BindingBase.)

System_CAPS_pubproperty

Gets or sets a value that indicates whether the Binding should get and set values asynchronously.

System_CAPS_pubproperty

Gets or sets a value that indicates the direction of the data flow in the binding.

System_CAPS_pubproperty

Gets or sets a value that indicates whether to raise the SourceUpdated event when a value is transferred from the binding target to the binding source.

System_CAPS_pubproperty

Gets or sets a value that indicates whether to raise the TargetUpdated event when a value is transferred from the binding source to the binding target.

System_CAPS_pubproperty

Gets or sets a value that indicates whether to raise the Error attached event on the bound object.

System_CAPS_pubproperty

Gets or sets the path to the binding source property.

System_CAPS_pubproperty

Gets or sets the binding source by specifying its location relative to the position of the binding target.

System_CAPS_pubproperty

Gets or sets the object to use as the binding source.

System_CAPS_pubproperty

Gets or sets a string that specifies how to format the binding if it displays the bound value as a string.(Inherited from BindingBase.)

System_CAPS_pubproperty

Gets or sets the value that is used in the target when the value of the source is null.(Inherited from BindingBase.)

System_CAPS_pubproperty

Gets or sets a handler you can use to provide custom logic for handling exceptions that the binding engine encounters during the update of the binding source value. This is only applicable if you have associated an ExceptionValidationRule with your binding.

System_CAPS_pubproperty

Gets or sets a value that determines the timing of binding source updates.

System_CAPS_pubproperty

Gets or sets a value that indicates whether to include the DataErrorValidationRule.

System_CAPS_pubproperty

Gets or sets a value that indicates whether to include the ExceptionValidationRule.

System_CAPS_pubproperty

Gets or sets a value that indicates whether to include the NotifyDataErrorValidationRule.

System_CAPS_pubproperty

Gets a collection of rules that check the validity of the user input.

System_CAPS_pubproperty

Gets or sets an XPath query that returns the value on the XML binding source to use.

NameDescription
System_CAPS_pubproperty System_CAPS_static XmlNamespaceManager

Gets or sets the XmlNamespaceManager used to perform namespace-aware XPath queries in XML bindings.

NameDescription
System_CAPS_pubmethod System_CAPS_static AddSourceUpdatedHandler

Adds a handler for the SourceUpdated attached event.

System_CAPS_pubmethod System_CAPS_static AddTargetUpdatedHandler

Adds a handler for the TargetUpdated attached event.

System_CAPS_pubmethod Equals

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethod Finalize

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethod GetHashCode

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethod GetType

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethod System_CAPS_static GetXmlNamespaceManager

Returns an XML namespace manager object used by the binding attached to the specified object.

System_CAPS_protmethod MemberwiseClone

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethod ProvideValue

Returns an object that should be set on the property where this binding and extension are applied.(Inherited from BindingBase.)

System_CAPS_pubmethod System_CAPS_static RemoveSourceUpdatedHandler

Removes a handler for the SourceUpdated attached event.

System_CAPS_pubmethod System_CAPS_static RemoveTargetUpdatedHandler

Removes a handler for the TargetUpdated attached event.

System_CAPS_pubmethod System_CAPS_static SetXmlNamespaceManager

Sets a namespace manager object used by the binding attached to the provided element.

System_CAPS_pubmethod ShouldSerializeFallbackValue

Returns a value that indicates whether serialization processes should serialize the effective value of the property on instances of this class.(Inherited from BindingBase.)

System_CAPS_pubmethod ShouldSerializePath

Indicates whether the property should be persisted.

System_CAPS_pubmethod ShouldSerializeSource

Indicates whether the property should be persisted.

System_CAPS_pubmethod ShouldSerializeTargetNullValue

Returns a value that indicates whether the property should be serialized.(Inherited from BindingBase.)

System_CAPS_pubmethod ShouldSerializeValidationRules

Indicates whether the property should be persisted.

System_CAPS_pubmethod ToString

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubfield System_CAPS_static DoNothing

Used as a returned value to instruct the binding engine not to perform any action.

System_CAPS_pubfield System_CAPS_static IndexerName

Used as the of System.ComponentModelPropertyChangedEventArgs to indicate that an indexer property has changed.

System_CAPS_pubfield System_CAPS_static SourceUpdatedEvent

Identifies the SourceUpdated attached event.

System_CAPS_pubfield System_CAPS_static TargetUpdatedEvent

Identifies the TargetUpdated attached event.

System_CAPS_pubfield System_CAPS_static XmlNamespaceManagerProperty

Identifies the XmlNamespaceManager attached property.

NameDescription
System_CAPS_pubevent System_CAPS_static SourceUpdated

Occurs when a value is transferred from the binding target to the binding source, but only for bindings with the value set to true.

System_CAPS_pubevent System_CAPS_static TargetUpdated

Occurs when a value is transferred from the binding source to the binding target, but only for bindings with the value set to true.

Windows Presentation Foundation (WPF) data binding provides a simple and consistent way for applications to present and interact with data. Data binding enables you to synchronize the values of the properties of two different objects.

To establish a binding, use the Binding class or one of the other classes that inherit BindingBase. Regardless of what object you are binding and the nature of your data source, each binding follows the model illustrated by the following figure.

Basic data binding diagram

The figure demonstrates the following fundamental WPF data binding concepts.

  • Each binding typically has these four components: a binding target object, a target property, a binding source, and a to the value in the binding source to use. For example, if you want to bind the content of a TextBox to the Name property of an Employee object, your target object is the TextBox, the target property is the property, the value to use is Name, and the source object is the Employee object.

  • The target property must be a dependency property. This also means that you cannot bind a field. Most properties of UIElement objects are dependency properties and most dependency properties, except read-only ones, support data binding by default. (Only DependencyObject types can define dependency properties and all UIElement objects derive from DependencyObject.)

  • Although not specified in the figure, it should be noted that the binding source object is not restricted to being a custom CLR object. WPF data binding supports data in the form of CLR objects and XML. To provide some examples, your binding source may be a UIElement, any list object, a CLR object that is associated with ADO.NET data or Web Services, or an XmlNode that contains your XML data.

Use the property to specify the direction of the data flow. To detect source changes in one-way or two-way bindings, the source must implement a suitable property change notification mechanism such as INotifyPropertyChanged. For an example, see How to: Implement Property Change Notification. The property specifies the timing of source updates. For more information, see "Basic Data Binding Concepts" in Data Binding Overview.

<object property="{Binding declaration}"/>
declaration

Zero or more attribute-assignment clauses separated by commas (,). For more information, see Binding Markup Extension or Binding Declarations Overview.

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top