AutomationElement.AutomationElementInformation.Name プロパティ

定義

要素の名前を取得します。

C#
public string Name { get; }

プロパティ値

ユーザー インターフェイス (UI) 要素の名前。

次の例は、 プロパティの取得方法を Name 示しています。

C#
/// <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.");
    }
}

注釈

要素の名前は、 プロパティが 要素でサポートされていない場合 AutomationId に、UI オートメーション要素ツリー内の要素を検索するために使用できます。

詳細については、「NameProperty」を参照してください。

適用対象

製品 バージョン
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10