Sprache

AutomationElement.LabeledByProperty Feld

Definition

Identifies the LabeledBy property, which identifies the label associated with a control.

public: static initonly System::Windows::Automation::AutomationProperty ^ LabeledByProperty;
public static readonly System.Windows.Automation.AutomationProperty LabeledByProperty;
 staticval mutable LabeledByProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly LabeledByProperty As AutomationProperty 

Feldwert

Beispiele

Im folgenden Beispiel wird der aktuelle Wert der Eigenschaft abgerufen. Der Standardwert wird zurückgegeben, wenn das Element kein Element bereitstellt.

AutomationElement labeler =
    autoElement.GetCurrentPropertyValue(AutomationElement.LabeledByProperty) as AutomationElement;
Dim labeler As AutomationElement = _
    DirectCast(autoElement.GetCurrentPropertyValue(AutomationElement.LabeledByProperty), _
    AutomationElement)

Das folgende Beispiel ruft den aktuellen Wert der Eigenschaft ab, gibt jedoch an, dass, wenn das Element selbst keinen Wert für die Eigenschaft bereitstellt, NotSupported anstelle eines Standardwerts zurückgegeben werden soll.

AutomationElement labeler1;
object labelerNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.LabeledByProperty, true);
if (labelerNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
    labeler1 = labelerNoDefault as AutomationElement;
}
Dim labeler1 As AutomationElement
Dim labelerNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.LabeledByProperty, True)
If labelerNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    labeler1 = DirectCast(labelerNoDefault, AutomationElement)
End If

Hinweise

Dieser Bezeichner wird von Benutzeroberflächenautomatisierung Clientanwendungen verwendet. Benutzeroberflächenautomatisierung Anbieter sollten den entsprechenden Bezeichner in AutomationElementIdentifiers verwenden.

Diese Eigenschaft kann auch aus den Current Eigenschaften abgerufen Cached werden.

Rückgabewerte der Eigenschaft sind vom Typ AutomationElement. Der Standardwert für die Eigenschaft lautet null.

Gilt für:

Weitere Informationen