AutomationElement.LabeledByProperty Fält

Definition

Identifierar egenskapen LabeledBy som identifierar etiketten som är associerad med en kontroll.

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 

Fältvärde

Exempel

I följande exempel hämtas det aktuella värdet för egenskapen. Standardvärdet returneras om elementet inte tillhandahåller något.

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

I följande exempel hämtas det aktuella värdet för egenskapen, men anger att om själva elementet inte tillhandahåller något värde för egenskapen NotSupported , returneras i stället för ett standardvärde.

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

Kommentarer

Den här identifieraren används av UI Automation klientprogram. UI Automation providers bör använda motsvarande identifierare i AutomationElementIdentifiers.

Den här egenskapen kan också hämtas från Current egenskaperna eller Cached .

Returvärden för egenskapen är av typen AutomationElement. Standardvärdet för egenskapen är null.

Gäller för

Se även