.NET Framework Class Library for Silverlight
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)
Syntax

Visual Basic (Declaration)
Public Class Binding _
    Inherits BindingBase
Visual Basic (Usage)
Dim instance As Binding
C#
public class Binding : BindingBase
XAML Object Element Usage
<Binding .../>
XAML

See Remarks

Remarks

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 specify the target element, target property and the data source. To bind to a property or a subproperty on a data object, set the Path property of the Binding object.

An instance of a Binding class can be applied to multiple targets.

You cannot modify the property values of a Binding object after you attach it to a target element.

Examples

The following example code demonstrates how to use this class.

Visual Basic
'Create the source string 
Dim s As String = "Hello"

'Create the binding description 
Dim b As New Binding("")
b.Mode = BindingMode.OneTime
b.Source = s

'Attach the binding to the target 
MyText.SetBinding(TextBlock.TextProperty, b)
C#
//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);
Inheritance Hierarchy

System..::.Object
  System.Windows.Data..::.BindingBase
    System.Windows.Data..::.Binding
Thread Safety

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

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

See Also

Reference

Other Resources

Tags :


Page view tracker