Defines a binding that connects the properties of binding targets and data sources.
Public Class Binding _ Inherits BindingBase
Dim instance As Binding
public class Binding : BindingBase
<Binding .../>
See 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.
The following example code demonstrates how to use this class.
'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)
//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);
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.