Modifica

Condividi tramite


TreeWalker.Normalize Method

Definition

Retrieves the ancestor element nearest to the specified AutomationElement in the tree view used by this instance of TreeWalker.

Overloads

Normalize(AutomationElement)

Retrieves the node itself, if it satisfies the Condition, or the nearest parent or ancestor node that satisfies the Condition.

Normalize(AutomationElement, CacheRequest)

Retrieves the node itself, if it satisfies the Condition, or the nearest parent or ancestor node that satisfies the Condition, and caches properties and patterns.

Remarks

The element is normalized by navigating up the ancestor chain in the tree until an element that satisfies the view condition for the TreeWalker object is reached. If the root element is reached, the root element is returned even if it does not satisfy the view condition.

This method is useful for applications that obtain references to UI Automation elements by hit-testing. The application might want to work only with specific types of elements, and can use Normalize to make sure that no matter what element is initially retrieved (for example, when a scroll bar gets the input focus), only the element of interest (such as a content element) is ultimately retrieved.

Normalize(AutomationElement)

Retrieves the node itself, if it satisfies the Condition, or the nearest parent or ancestor node that satisfies the Condition.

public:
 System::Windows::Automation::AutomationElement ^ Normalize(System::Windows::Automation::AutomationElement ^ element);
public System.Windows.Automation.AutomationElement Normalize (System.Windows.Automation.AutomationElement element);
member this.Normalize : System.Windows.Automation.AutomationElement -> System.Windows.Automation.AutomationElement
Public Function Normalize (element As AutomationElement) As AutomationElement

Parameters

element
AutomationElement

The element from which to start the normalization.

Returns

The nearest AutomationElement in the current view. If the navigation up the ancestor chain reaches the root element, the root element is returned.

Remarks

The element is normalized by navigating up the ancestor chain in the tree until an element that satisfies the view condition for the TreeWalker object is reached. If the root element is reached, the root element is returned even if it does not satisfy the view condition.

This method is useful for applications that obtain references to UI Automation elements by hit-testing. The application might want to work only with specific types of elements, and can use Normalize to make sure that no matter what element is initially retrieved (for example, when a scroll bar gets the input focus), only the element of interest (such as a content element) is ultimately retrieved.

See also

Applies to

Normalize(AutomationElement, CacheRequest)

Retrieves the node itself, if it satisfies the Condition, or the nearest parent or ancestor node that satisfies the Condition, and caches properties and patterns.

public:
 System::Windows::Automation::AutomationElement ^ Normalize(System::Windows::Automation::AutomationElement ^ element, System::Windows::Automation::CacheRequest ^ request);
public System.Windows.Automation.AutomationElement Normalize (System.Windows.Automation.AutomationElement element, System.Windows.Automation.CacheRequest request);
member this.Normalize : System.Windows.Automation.AutomationElement * System.Windows.Automation.CacheRequest -> System.Windows.Automation.AutomationElement
Public Function Normalize (element As AutomationElement, request As CacheRequest) As AutomationElement

Parameters

element
AutomationElement

The element from which to start the normalization.

request
CacheRequest

A cache request object specifying properties and patterns on the returned AutomationElement to cache.

Returns

The nearest AutomationElement in the current view. If the navigation up the ancestor chain reaches the root element, the root element is returned.

Remarks

The element is normalized by navigating up the ancestor chain in the tree until an element that satisfies the view condition for the TreeWalker object is reached. If the root element is reached, the root element is returned even if it does not satisfy the view condition.

This method is useful for applications that obtain references to UI Automation elements by hit-testing. The application might want to work only with specific types of elements, and can use Normalize to make sure that no matter what element is initially retrieved (for example, when a scroll bar gets the input focus), only the element of interest (such as a content element) is ultimately retrieved.

See also

Applies to