AutomationElement.AutomationElementInformation.Name 속성

정의

요소의 이름을 가져옵니다.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

속성 값

UI(사용자 인터페이스)user interface (UI) 요소의 이름입니다.The name of the UI(사용자 인터페이스)user interface (UI) element.

예제

다음 예제와 방법을 Name 속성을 검색 합니다.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

설명

요소 이름 요소를 찾는 데 사용할 수는 UI 자동화UI Automation 요소 트리에서 AutomationId 속성 요소에서 지원 되지 않습니다.The name of an element can be used to find the element in the UI 자동화UI Automation element tree when the AutomationId property is not supported on the element.

자세한 내용은 NameProperty을 참조하세요.For more information, see NameProperty.

적용 대상