IXamlDiagnostics2::HitTestForXamlRoot method (xamlom.winui.h)

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

Syntax

HRESULT HitTestForXamlRoot(
  InstanceHandle instanceHandle,
  RECT           rect,
  unsigned int   *pCount,
  InstanceHandle **ppInstanceHandles
);

Parameters

instanceHandle

A handle to the XamlRoot instance.

rect

The area to hit test.

pCount

The number of elements found.

ppInstanceHandles

An array containing all found elements.

Return value

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

Remarks

This method performs hit testing for the XamlRoot passed in as instanceHandle, within the bounds of rect. Returns the number of elements hit in pCount and the elements themselves in ppInstanceHandles. This method replaces IXamlDiagnostics::HitTest, which assumes there is only one main window and only performs hit testing within it.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1809 (with Windows App SDK 1.0 or later)
Header xamlom.winui.h