AutomationElement.RootElement Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the root AutomationElement for the current desktop.
public:
static property System::Windows::Automation::AutomationElement ^ RootElement { System::Windows::Automation::AutomationElement ^ get(); };
public static System.Windows.Automation.AutomationElement RootElement { get; }
static member RootElement : System.Windows.Automation.AutomationElement
Public Shared ReadOnly Property RootElement As AutomationElement
Property Value
The root element.
Examples
The following example code retrieves a collection of all the immediate children of the desktop.
AutomationElementCollection desktopChildren =
AutomationElement.RootElement.FindAll(
TreeScope.Children, Condition.TrueCondition);
Dim desktopChildren As AutomationElementCollection
desktopChildren = AutomationElement.RootElement.FindAll( _
TreeScope.Children, Condition.TrueCondition)
Remarks
You can use the root element as a starting point for finding other elements, using the FindAll and FindFirst methods.
When searching from the root element, be sure to specify Children in the scope of the search, not Descendants. A search through the entire subtree of the desktop could iterate through thousands of items and lead to a stack overflow.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈