IXamlDiagnostics::HitTest method (xamlom.h)

Gets all elements in the visual tree that fall within the specified rectangle.

Syntax

HRESULT HitTest(
  [in]  RECT           rect,
  [out] unsigned int   *pCount,
  [out] InstanceHandle **ppInstanceHandles
);

Parameters

[in] rect

The area to hit test.

[out] pCount

The size of the array.

[out] ppInstanceHandles

An array containing all elements.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method performs a hit test on the XAML visual tree and will return all elements regardless if they are enabled or invisible for hit testing. This method does not return collapsed elements as they do not participate in layout. AdviseVisualTreeChange must be called before this method. The element does not need to be fully enclosed in the rect area to be returned.

Requirements

Requirement Value
Minimum supported client Windows 10 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header xamlom.h

See also

IXamlDiagnostics