AutomationElement.Current Vlastnost

Definice

Získá aktuální vlastnosti hodnoty 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

Hodnota vlastnosti

AutomationElement.AutomationElementInformation

Struktura obsahující aktuální hodnoty vlastností.

Výjimky

Uživatelské rozhraní již AutomationElement neexistuje.

Příklady

Následující příklad ukazuje, jak se Current vlastnost používá k načtení názvu položky, která byla vybrána v seznamu.

/// <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

Poznámky

Přístupové objekty pro vlastnosti model UI Automation jsou reprezentovány jako vlastnosti struktury vrácené Current. Nemusíte načítat strukturu; k jeho členům můžete přistupovat přímo, jak je znázorněno v následujícím příkladu. Konkrétní informace o dostupných vlastnostech a jejich použití naleznete v tématu AutomationElement.AutomationElementInformation.

Chcete-li získat hodnotu uložené v mezipaměti model UI Automation vlastností tohoto prvku, použijte Cached vlastnost.

Platí pro

Viz také