FrameworkElement.SetBinding method

Expand
This topic has not yet been rated - Rate this topic

FrameworkElement.SetBinding method

[This documentation is preliminary and is subject to change.]

Attaches a binding to a FrameworkElement, using the provided binding object.

Syntax


public void SetBinding(
  DependencyProperty dp, 
  BindingBase binding
)

Parameters

dp

Type: DependencyProperty

The dependency property identifier of the property that is data bound.

binding

Type: BindingBase

The binding to use for the property.

Examples

This example establishes a binding to a dependency property on an object by calling SetBinding.


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


Requirements

Minimum supported client

Windows 8 Release Preview

Minimum supported server

Windows Server 2012

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

FrameworkElement
Binding
BindingOperations

 

 

Build date: 5/22/2012

Did you find this helpful?
(1500 characters remaining)
Community Additions ADD