Gets or sets the name of the element to use as the binding source for the Binding.
Syntax
<Binding ElementName="nameString"/>
XAML Values
- nameString
-
The value of the Name property or x:Name attribute for the element of interest.
Property value
Type: System.String [.NET] | Platform::String [C++]
The value of the Name property or x:Name attribute for the element to bind to. The default is null.
Remarks
When you set this property, the specified value must refer to an element in one of the following locations:
- The current XAML namescope.
- The XAML namescope of the templated parent if the binding target is in a data template or control template.
Examples
The following code example demonstrates how to establish a two-way binding between a TextBox and a Slider control. For the complete code listing, see scenario 1 in the XAML data binding sample.
<Slider x:Name="slider1" Minimum="1" Maximum="100"/> <TextBox Text="{Binding ElementName=slider1, Path=Value, Mode=TwoWay}"/>
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012