AutomationElement.RootElement Propiedad

Definición

Obtiene el objeto AutomationElement raíz del escritorio actual.

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

Valor de propiedad

AutomationElement

Elemento raíz.

Ejemplos

El código de ejemplo siguiente recupera una colección de todos los elementos secundarios inmediatos del escritorio.

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

Comentarios

Puede usar el elemento raíz como punto de partida para buscar otros elementos mediante los FindAll métodos y FindFirst .

Al buscar desde el elemento raíz, asegúrese de especificar Children en el ámbito de la búsqueda, no Descendantsen . Una búsqueda en todo el subárbol del escritorio podría recorrer en iteración miles de elementos y provocar un desbordamiento de pila.

Se aplica a