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 System.Windows.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)
Declaration
[NotImplemented]
public static IEnumerable<UIElement> FindElementsInHostCoordinates(Rect intersectingRect, UIElement subtree)
Parameters
Type | Name | Description |
---|---|---|
Rect | intersectingRect | |
UIElement | subtree |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<UIElement> |
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. |
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. |
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. |
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. |
GetVisualChildren(DependencyObject)
Get the visual tree children of an element.
Declaration
public static IEnumerable<DependencyObject> GetVisualChildren(DependencyObject element)
Parameters
Type | Name | Description |
---|---|---|
DependencyObject | element | The element. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<DependencyObject> | The visual tree children of an element. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|