Class VisualTreeHelper
Provides utility methods that can used to traverse object relationships (along child object or parent object axes) in the visual tree.
Inheritance
Inherited Members
Namespace: System.Windows.Media
Assembly: OpenSilver.dll
Syntax
public sealed class VisualTreeHelper
Methods
| Improve this Doc View SourceFindElementsInHostCoordinates(Point, UIElement)
Retrieves a set of objects that are located within a specified point of an object's coordinate space.
Declaration
public static IEnumerable<UIElement> FindElementsInHostCoordinates(Point intersectingPoint, UIElement subtree)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | intersectingPoint | The point to use as the determination point. |
| UIElement | subtree | The object to search within. |
Returns
| Type | Description |
|---|---|
| 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 subtee. |
FindElementsInHostCoordinates(Rect, UIElement)
Retrieves a set of objects that are located within a specified Rect of an object's coordinate space.
Declaration
[NotImplemented]
public static IEnumerable<UIElement> FindElementsInHostCoordinates(Rect intersectingRect, UIElement subtree)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | intersectingRect | The Rect to use as the determination area. |
| UIElement | subtree | The object to search within. |
Returns
| Type | Description |
|---|---|
| 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 subtee. |
GetChild(DependencyObject, Int32)
Using the provided index, obtains a specific child object of the provided object by examining the visual tree. Please note that the current implementation does not guarantee that the index corresponds to the visual order of the controls.
Declaration
public static DependencyObject GetChild(DependencyObject reference, int childIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | reference | The object that holds the child collection. |
| System.Int32 | childIndex | The index of the requested child object in the reference child collection. Please note that the current implementation does not guarantee that the index corresponds to the visual order of the controls. |
Returns
| Type | Description |
|---|---|
| DependencyObject | The child object as referenced by childIndex. |
GetChild(UIElement, Int32)
Declaration
public static DependencyObject GetChild(UIElement reference, int childIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| UIElement | reference | |
| System.Int32 | childIndex |
Returns
| Type | Description |
|---|---|
| DependencyObject |
GetChildrenCount(DependencyObject)
Returns the number of children that exist in an object's child collection in the visual tree.
Declaration
public static int GetChildrenCount(DependencyObject reference)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | reference | The source visual. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of visual children for the provided source visual. |
GetChildrenCount(UIElement)
Returns the number of children that exist in an object's child collection in the visual tree.
Declaration
public static int GetChildrenCount(UIElement reference)
Parameters
| Type | Name | Description |
|---|---|---|
| UIElement | reference | The source visual. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of visual children for the provided source visual. |
GetOpenPopups()
Gets all open Popup controls.
Declaration
public static List<Popup> GetOpenPopups()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<Popup> | A list of all open Popup controls. |
GetOpenPopups(Window)
Declaration
public static List<Popup> GetOpenPopups(Window window)
Parameters
| Type | Name | Description |
|---|---|---|
| Window | window |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<Popup> | A list of all open Popup controls. |
GetParent(DependencyObject)
Returns an object's parent object in the visual tree.
Declaration
public static DependencyObject GetParent(DependencyObject reference)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | reference | The object for which to get the parent object. |
Returns
| Type | Description |
|---|---|
| DependencyObject | The parent object of the reference object in the visual tree. |
GetParent(IDependencyObject)
Returns an object's parent object in the visual tree.
Declaration
public static DependencyObject GetParent(IDependencyObject reference)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.IDependencyObject | reference | The object for which to get the parent object. |
Returns
| Type | Description |
|---|---|
| DependencyObject | The parent object of the reference object in the visual tree. |
GetParent(UIElement)
Returns an object's parent object in the visual tree.
Declaration
public static DependencyObject GetParent(UIElement reference)
Parameters
| Type | Name | Description |
|---|---|---|
| UIElement | reference | The object for which to get the parent object. |
Returns
| Type | Description |
|---|---|
| DependencyObject | The parent object of the reference object in the visual tree. |
GetRoot(DependencyObject)
Returns an object's root object in the visual tree.
Declaration
public static DependencyObject GetRoot(DependencyObject reference)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | reference | The object to get the root object for. |
Returns
| Type | Description |
|---|---|
| DependencyObject | The root object of the reference object in the visual tree. |