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.

Binding Class

Defines a binding that connects the properties of binding targets and data sources.

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

public class Binding : BindingBase, ISupportInitialize
See Remarks

The Binding type exposes the following members.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneBinding()Initializes a new instance of the Binding class.
Public methodBinding(Binding)Initializes a new instance of the Binding class with initial property values copied from the specified Binding.
Public methodSupported by Silverlight for Windows PhoneBinding(String)Initializes a new instance of the Binding class with an initial property path for the data source.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneBindsDirectlyToSourceGets or sets a value that indicates whether the binding ignores any ICollectionView settings on the data source.
Public propertySupported by Silverlight for Windows PhoneConverterGets or sets the converter object that is called by the binding engine to modify the data as it is passed between the source and target, or vice versa.
Public propertySupported by Silverlight for Windows PhoneConverterCultureGets or sets the culture to be used by the Converter.
Public propertySupported by Silverlight for Windows PhoneConverterParameterGets or sets a parameter that can be used in the Converter logic.
Public propertySupported by Silverlight for Windows PhoneElementNameGets or sets the name of the element to use as the binding source object.
Public propertySupported by Silverlight for Windows PhoneFallbackValueGets or sets the value to use when the binding is unable to return a value. (Inherited from BindingBase.)
Public propertySupported by Silverlight for Windows PhoneModeGets or sets a value that indicates the direction of the data flow in the binding.
Public propertySupported by Silverlight for Windows PhoneNotifyOnValidationErrorGets or sets a value that indicates whether the BindingValidationError event is raised on validation errors.
Public propertySupported by Silverlight for Windows PhonePathGets or sets the path to the binding source property.
Public propertySupported by Silverlight for Windows PhoneRelativeSourceGets or sets the binding source by specifying its location relative to the position of the binding target.
Public propertySupported by Silverlight for Windows PhoneSourceGets or sets the data source for the binding.
Public propertySupported by Silverlight for Windows PhoneStringFormatGets or sets a string that specifies how to format the binding if it displays the bound value as a string. (Inherited from BindingBase.)
Public propertySupported by Silverlight for Windows PhoneTargetNullValueGets or sets the value that is used in the target when the value of the source is null. (Inherited from BindingBase.)
Public propertySupported by Silverlight for Windows PhoneUpdateSourceTriggerGets or sets a value that determines the timing of binding source updates for two-way bindings.
Public propertySupported by Silverlight for Windows PhoneValidatesOnDataErrorsGets or sets a value that indicates whether the binding engine will report validation errors from an IDataErrorInfo implementation on the bound data entity.
Public propertySupported by Silverlight for Windows PhoneValidatesOnExceptionsGets or sets a value that indicates whether the binding engine will report exception validation errors.
Public propertySupported by Silverlight for Windows PhoneValidatesOnNotifyDataErrorsGets or sets a value that indicates whether the binding engine will report validation errors from an INotifyDataErrorInfo implementation on the bound data entity.
Top

  NameDescription
Protected methodSupported by Silverlight for Windows PhoneCheckSealedThrows an exception if the binding has already been attached to a binding target. (Inherited from BindingBase.)
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodProvideValueReturns an object that should be set on the property where this binding and extension are applied. (Inherited from BindingBase.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public fieldStatic memberIsDebuggingEnabledIndicates whether data binding debugging is enabled.
Top

  NameDescription
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneISupportInitialize.BeginInitSignals the object that initialization is starting.
Explicit interface implemetationPrivate methodSupported by Silverlight for Windows PhoneISupportInitialize.EndInitSignals the object that initialization is complete.
Top

For XAML attribute usage for properties that can take a Binding, or that can otherwise be set to a data-bound value, see Binding Markup Extension. The Binding markup extension enables you to specify a Binding value as a single attribute string, including setting Binding properties such as Path and Source.

A Binding object connects a dependency property of a FrameworkElement directly to a data object so that updates to the data object are automatically propagated to the property. The Binding class defines the properties of a binding. Each binding must have a target element, target property, and data source, although some values are provided by default if you do not specify them.

To bind to a property or a subproperty on a data object, set the Path property of the Binding object. For more information, see Property Path Syntax.

You can apply an instance of a Binding class to multiple targets. However, you cannot modify the property values of a Binding object after you attach it to a target element.

NoteNote:

Calling the FrameworkElement.SetBinding method and passing in a new Binding object will not necessarily remove an existing binding. Instead, you should use the DependencyObject.ClearValue method.

The following example code demonstrates how to use this class.


//Create the source string
string s = "Hello";

//Create the binding description
Binding b = new Binding("");
b.Mode = BindingMode.OneTime;
b.Source = s;

//Attach the binding to the target
MyText.SetBinding(TextBlock.TextProperty, b);


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

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

Community Additions

Show:
© 2014 Microsoft