AutomationElement.ControlTypeProperty Fält
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Identifierar egenskapen ControlType .
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
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.
ControlType controlTypeId =
autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty)
as ControlType;
Dim controlTypeId As ControlType = _
DirectCast(autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty), ControlType)
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.
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
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 .
Standardvärdet för egenskapen är Custom