Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Binding Constructor (String)

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)

public Binding(
	string path
)

Parameters

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

ExceptionCondition
ArgumentNullException

path is null.

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 ("").


//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.

Community Additions

ADD
Show:
© 2015 Microsoft