AutomationPeer.GetLabeledBy 方法


取得以該項目為目標之 LabelAutomationPeerGets the AutomationPeer for the Label that is targeted to the element.

 System::Windows::Automation::Peers::AutomationPeer ^ GetLabeledBy();
public System.Windows.Automation.Peers.AutomationPeer GetLabeledBy ();
member this.GetLabeledBy : unit -> System.Windows.Automation.Peers.AutomationPeer
Public Function GetLabeledBy () As AutomationPeer



項目的 LabelAutomationPeerLabel 的目標。The LabelAutomationPeer for the element that is targeted by the Label.


目前正在公開呼叫此方法。A public call to this method is currently in progress.


例如,如果元素是 ComboBox 控制項,則 GetLabeledBy 方法 AutomationPeer 會取得 Label 與相關聯的 ComboBoxFor example, if the element is a ComboBox control, the GetLabeledBy method gets the AutomationPeer for the Label that is associated with the ComboBox.

在下圖中,「 Label 主題」的目標為,因此的也會以為 ComboBox AccessKey Label 目標 ComboBoxIn the following image, the Label "Themes" is targeted to the ComboBox; therefore the AccessKey for the Label also targets the ComboBox. 當使用者按下 ALT + T 時,會 ComboBox 取得焦點,而不是 LabelWhen the user presses ALT+T, the ComboBox gets focus instead of the Label.

顯示依使用方式加上標籤的屬性Display properties shows labeled by usage

GetLabeledBy 方法會 ComboBoxAutomationPeer LabelAutomationPeer 針對對應的傳回的 LabelThe GetLabeledBy method for ComboBoxAutomationPeer returns the LabelAutomationPeer for the corresponding Label. 這可讓 automation 用戶端取得描述的文字字串 ComboBoxThis enables an automation client to get the text string that describes the ComboBox.