AutomationElement.AutomationElementInformation.Name AutomationElement.AutomationElementInformation.Name AutomationElement.AutomationElementInformation.Name AutomationElement.AutomationElementInformation.Name Property

Definition

Ruft den Namen des Elements ab.Gets the name of the element.

public:
 property System::String ^ Name { System::String ^ get(); };
public string Name { get; }
member this.Name : string
Public ReadOnly Property Name As String

Eigenschaftswert

Der Name des Benutzeroberfläche (User Interface, UI)user interface (UI)-Elements.The name of the Benutzeroberfläche (User Interface, UI)user interface (UI) element.

Beispiele

Im folgenden Beispiel wird gezeigt, Name wie die-Eigenschaft abgerufen wird.The following example shows how the Name property is retrieved.

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

Hinweise

Der Name eines Elements kann verwendet werden, um das Element in der BenutzeroberflächenautomatisierungUI Automation -Elementstruktur zu suchen, wenn die AutomationId -Eigenschaft für das Element nicht unterstützt wird.The name of an element can be used to find the element in the BenutzeroberflächenautomatisierungUI Automation element tree when the AutomationId property is not supported on the element.

Weitere Informationen finden Sie unter NameProperty.For more information, see NameProperty.

Gilt für: