AutomationProperties.LabeledBy attached property
Gets or sets the element that contains the text label for the element.
<object AutomationProperties.LabeledBy="referenceToElement" />
XAML Values
- referenceToElement
-
A binding reference to the element that is this element's designated label. The binding reference is typically made in the form
{Binding ElementName=nameHere}, where nameHere is the Name or x:Name of the labeling element. For this usage to work, the element name lookup must be able to use the default data context.
Remarks
When getting this property in code, use GetLabeledBy. When setting this property in code, use SetLabeledBy.
The most common way to set this attached property is through an ElementName binding. An ElementName binding is a Binding declaration that specifies another element in the UI by name, passing that name to the ElementName attribute or property of the binding declaration.
A {TemplateBinding} markup extension associates a value of the templated control with some property within the template's definition structure. This might be used if the templated control has a dedicated property for tracking label associations. If you are declaring control composition in a template, and you are the control author, you could make this call part of your OnApplyTemplate handling.
For more information on data binding concepts, including ElementName binding, see Data binding overview.
Requirements (Windows 10 device family)
|
API contract | |
|---|---|
|
Namespace |
Windows.UI.Xaml.Automation |
|
Metadata |
Requirements (Windows 8.x and Windows Phone 8.x)
|
Minimum supported client |
Windows 8 |
|---|---|
|
Minimum supported server |
Windows Server 2012 |
|
Minimum supported phone |
Windows Phone 8.1 [Windows Runtime apps only] |
|
Namespace |
Windows.UI.Xaml.Automation |
|
Metadata |
|
See also