GetLabeledBy Method
Collapse the table of content
Expand the table of content

AutomationPeer.GetLabeledBy Method

Gets the AutomationPeer for the Label that is targeted to the element.

Namespace: System.Windows.Automation.Peers
Assembly: PresentationCore (in presentationcore.dll)

Public Function GetLabeledBy As AutomationPeer
Dim instance As AutomationPeer
Dim returnValue As AutomationPeer

returnValue = instance.GetLabeledBy
public AutomationPeer GetLabeledBy ()
public function GetLabeledBy () : AutomationPeer
You cannot use methods in XAML.

Return Value

The LabelAutomationPeer for the element that is targeted by the Label.

For example, if the element is a ComboBox control, the GetLabeledBy method gets the AutomationPeer for the Label that is associated with the ComboBox.

In the following image, the Label "Themes" is targeted to the ComboBox; therefore the AccessKey for the Label also targets the ComboBox. When the user presses ALT+T, the ComboBox gets focus instead of the Label.

The GetLabeledBy method for ComboBoxAutomationPeer returns the LabelAutomationPeer for the corresponding Label. This enables an automation client to get the text string that describes the ComboBox.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2015 Microsoft