Partager via


VisualTreeHelper.FindElementsInHostCoordinates Method (Rect, Window)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Shared Function FindElementsInHostCoordinates ( _
    intersectingRect As Rect, _
    window As Window _
) As IEnumerable(Of UIElement)
public static IEnumerable<UIElement> FindElementsInHostCoordinates(
    Rect intersectingRect,
    Window window
)

Parameters

Return Value

Type: System.Collections.Generic.IEnumerable<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 window.

Remarks

You must specify some window for the window value to specify a frame of reference.

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 simulated drag action by the mouse, 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 previous versions of Silverlight and in WPF.

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.