AutomationElement.ControlTypeProperty Campo

Definição

Identifica a propriedade 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 

Valor do campo

Exemplos

O exemplo a seguir recupera o valor atual da propriedade . O valor padrão será retornado se o elemento não fornecer um.

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

O exemplo a seguir recupera o valor atual da propriedade , mas especifica que, se o elemento em si não fornecer um valor para a propriedade , NotSupported deverá ser retornado em vez de um valor padrão.

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

Comentários

Esse identificador é usado por aplicativos cliente da Automação da Interface do Usuário. Os provedores de Automação da Interface do Usuário devem usar o identificador equivalente no AutomationElementIdentifiers.

Essa propriedade também pode ser recuperada das Current propriedades ou Cached .

O valor padrão para a propriedade é Custom

Aplica-se a

Confira também