VisualTreeHelper.FindElementsInHostCoordinates Method (Rect, UIElement)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Retrieves a set of objects that are located within a specified Rect of an object's coordinate space.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

Syntax

Public Shared Function FindElementsInHostCoordinates ( _
    intersectingRect As Rect, _
    subtree As UIElement _
) As IEnumerable(Of UIElement)
public static IEnumerable<UIElement> FindElementsInHostCoordinates(
    Rect intersectingRect,
    UIElement subtree
)

Parameters

Return Value

Type: System.Collections.Generic..::.IEnumerable<(Of <(UIElement>)>)
An enumerable set of UIElement objects that are determined to be located in the visual tree composition at the specified point and within the specified subtee.

Remarks

You must specify some object for the subtree value to specify a frame of reference. If you want to use the most general frame of reference available (the entire content area of Windows Phone), use Application..::.RootVisual as the subtree input.

For this signature, because the determination is done by an area, multiple elements might be returned, and no meaning can be assigned to the order of returned elements in the set.

The input Rect might be the result of a selection, where a start point and end point were captured and could be used to compose a Rect.

FindElementsInHostCoordinates is fundamentally similar to the HitTest methods in other frameworks.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

VisualTreeHelper Class

FindElementsInHostCoordinates Overload

System.Windows.Media Namespace