Binding Constructor (String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Initializes a new instance of the Binding class with an initial property path for the data source.

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

Syntax

'Declaration
Public Sub New ( _
    path As String _
)
public Binding(
    string path
)

Parameters

  • path
    Type: System.String
    The initial property path for the source of the binding.

Exceptions

Exception Condition
ArgumentNullException

path is nulla null reference (Nothing in Visual Basic).

Remarks

The path can be a direct property of the source object or subproperties.

To set the data source to be the Source object, the path should be an empty string ("").

Examples

'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);

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

Platforms

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