Class VisualUtil
Represents a class that provides various helper methods used to find the child and parent of visual object from visual tree.
Inheritance
System.Object
    VisualUtil
  Namespace: Syncfusion.UI.Xaml.Controls.Navigation
Assembly: Syncfusion.SfMenu.UWP.dll
Syntax
[ClassReference(IsReviewed = false)]
public static class VisualUtil : Object
  Methods
FindAncestor(DependencyObject, Type)
Finds the ancestor.
Declaration
public static DependencyObject FindAncestor(DependencyObject startingFrom, Type ancestorType)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Windows.UI.Xaml.DependencyObject | startingFrom | The starting from.  | 
      
| System.Type | ancestorType | The ancestor type.  | 
      
Returns
| Type | Description | 
|---|---|
| Windows.UI.Xaml.DependencyObject | Parent of logical child  | 
      
FindDescendant(DependencyObject, Type)
To get the Visual child elements
Declaration
public static DependencyObject FindDescendant(DependencyObject startingFrom, Type typeDescendant)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Windows.UI.Xaml.DependencyObject | startingFrom | The starting from.  | 
      
| System.Type | typeDescendant | The descendant type.  | 
      
Returns
| Type | Description | 
|---|---|
| Windows.UI.Xaml.DependencyObject | Child of logical parent  | 
      
FindVisualParent<T>(DependencyObject)
Finds a parent of a given item on the visual tree.
Declaration
public static T FindVisualParent<T>(DependencyObject child)
    where T : DependencyObject
  Parameters
| Type | Name | Description | 
|---|---|---|
| Windows.UI.Xaml.DependencyObject | child | A direct or indirect child of the queried item.  | 
      
Returns
| Type | Description | 
|---|---|
| T | The first parent item that matches the submitted type parameter. If not matching item can be found, a null reference is being returned.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T | The type of the queried item.  | 
      
GetVisualDescendants(DependencyObject)
Helps to find the descendant elements of the provided visual object by searching in visual tree.
Declaration
public static IEnumerable<DependencyObject> GetVisualDescendants(this DependencyObject element)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Windows.UI.Xaml.DependencyObject | element | The element of the parent  | 
      
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<Windows.UI.Xaml.DependencyObject> | Child of logical parent  |