Поделиться через


VisualTreeHelper Class

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

Provides utility methods that can used to traverse object relationships (along child object or parent object axes) in the Silverlight visual tree.

Inheritance Hierarchy

System.Object
  System.Windows.Media.VisualTreeHelper

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

Syntax

'Declaration
Public NotInheritable Class VisualTreeHelper
public static class VisualTreeHelper

The VisualTreeHelper type exposes the following members.

Methods

  Name Description
Public methodStatic memberSupported by Silverlight for Windows Phone FindElementsInHostCoordinates(Point, UIElement) Retrieves a set of objects that are located within a specified point of an object's coordinate space.
Public methodStatic member FindElementsInHostCoordinates(Point, Window) Retrieves a set of objects that are located within a specified point of a window's coordinate space.
Public methodStatic memberSupported by Silverlight for Windows Phone FindElementsInHostCoordinates(Rect, UIElement) Retrieves a set of objects that are located within a specified Rect of an object's coordinate space.
Public methodStatic member FindElementsInHostCoordinates(Rect, Window) Retrieves a set of objects that are located within a specified Rect of a window's coordinate space.
Public methodStatic memberSupported by Silverlight for Windows Phone GetChild Using the provided index, obtains a specific child object of the provided object by examining the visual tree.
Public methodStatic memberSupported by Silverlight for Windows Phone GetChildrenCount Returns the number of children that exists in an object's child collection in the visual tree.
Public methodStatic memberSupported by Silverlight for Windows Phone GetOpenPopups() Gets all open Popup controls.
Public methodStatic member GetOpenPopups(Window) Gets all open Popup controls.
Public methodStatic memberSupported by Silverlight for Windows Phone GetParent Returns an object's parent object in the visual tree.
Public methodStatic member GetRoot Returns an object's root object in the visual tree.

Top

Remarks

A visual tree is a programming concept that is shared between WPF and Silverlight. In WPF, Visual is a class. Silverlight 5 does not expose a Visual class as an extension point, but still provides this helper class so that you can examine the visual tree structure.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Other Resources