Share via


AutomationElement.RootElement プロパティ

定義

現在のデスクトップのルート AutomationElement を取得します。

public:
 static property System::Windows::Automation::AutomationElement ^ RootElement { System::Windows::Automation::AutomationElement ^ get(); };
public static System.Windows.Automation.AutomationElement RootElement { get; }
member this.RootElement : System.Windows.Automation.AutomationElement
Public Shared ReadOnly Property RootElement As AutomationElement

プロパティ値

AutomationElement

ルート要素。

次のコード例では、デスクトップのすべての直接の子のコレクションを取得します。

AutomationElementCollection desktopChildren =
    AutomationElement.RootElement.FindAll(
    TreeScope.Children, Condition.TrueCondition);
Dim desktopChildren As AutomationElementCollection
desktopChildren = AutomationElement.RootElement.FindAll( _
    TreeScope.Children, Condition.TrueCondition)

注釈

ルート要素は、他の要素を検索するための開始点として、およびFindFirstメソッドをFindAll使用して使用できます。

ルート要素から検索する場合は、検索のDescendantsスコープで指定Childrenしてください。 デスクトップのサブツリー全体を検索すると、何千もの項目が反復処理され、スタック オーバーフローが発生する可能性があります。

適用対象