AutomationElement.Current Propriedade

Definição

Obtém os valores atuais das propriedades do AutomationElement.

public:
 property System::Windows::Automation::AutomationElement::AutomationElementInformation Current { System::Windows::Automation::AutomationElement::AutomationElementInformation get(); };
public System.Windows.Automation.AutomationElement.AutomationElementInformation Current { get; }
member this.Current : System.Windows.Automation.AutomationElement.AutomationElementInformation
Public ReadOnly Property Current As AutomationElement.AutomationElementInformation

Valor de Propriedade

Uma estrutura contendo os valores atuais das propriedades.

Exceções

A interface para a AutomationElement interface já não existe.

Exemplos

O exemplo seguinte mostra como a Current propriedade é usada para recuperar o nome de um item que foi selecionado numa lista.

/// <summary>
/// Handles ElementSelected events by showing a message.
/// </summary>
/// <param name="src">Object that raised the event; in this case, a list item.</param>
/// <param name="e">Event arguments.</param>
private void OnSelect(object src, AutomationEventArgs e)
{
    // Get the name of the item, which is equivalent to its text.
    AutomationElement element = src as AutomationElement;
    if (element != null)
    {
        Console.WriteLine(element.Current.Name + " was selected.");
    }
}
''' <summary>
''' Handles ElementSelected events by showing a message.
''' </summary>
''' <param name="src">Object that raised the event; in this case, a list item.</param>
''' <param name="e">Event arguments.</param>
Private Sub OnSelect(ByVal src As Object, ByVal e As AutomationEventArgs)
    ' Get the name of the item, which is equivalent to its text.
    Dim element As AutomationElement = DirectCast(src, AutomationElement)
    If (element IsNot Nothing) Then
        Console.WriteLine(element.Current.Name + " was selected.")
    End If

End Sub

Observações

Os acessores para Automatização da Interface de Utilizador propriedades são representados como propriedades da estrutura devolvida por Current. Não precisa de recuperar a estrutura; Pode aceder diretamente aos seus membros, como no exemplo abaixo. Para informações específicas sobre as propriedades disponíveis e a sua utilização, veja AutomationElement.AutomationElementInformation.

Para obter o valor em cache das propriedades Automatização da Interface de Utilizador neste elemento, use a propriedade Cached.

Aplica-se a

Ver também