AutomationElement.ControlTypeProperty Feld

Definition

Identifies the ControlType property.

public: static initonly System::Windows::Automation::AutomationProperty ^ ControlTypeProperty;
public static readonly System.Windows.Automation.AutomationProperty ControlTypeProperty;
 staticval mutable ControlTypeProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ControlTypeProperty 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.

ControlType controlTypeId = 
    autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty)
    as ControlType;
Dim controlTypeId As ControlType = _
  DirectCast(autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty), ControlType)

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.

ControlType controlTypeId1;
object controlTypeNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty, true);
if (controlTypeNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else  
{
    controlTypeId1 = controlTypeNoDefault as ControlType;
}
Dim controlTypeId1 As ControlType
Dim controlTypeNoDefault As Object = _
    autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty, True)
If controlTypeNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    controlTypeId1 = DirectCast(controlTypeNoDefault, ControlType)
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.

Der Standardwert für die Eigenschaft ist Custom

Gilt für:

Weitere Informationen