menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class VisualTree - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class VisualTree

    Defines a collection of extensions methods for UI.

    Inheritance
    System.Object
    VisualTree
    Namespace: Syncfusion.UI.Xaml.Core
    Assembly: Syncfusion.Core.WinUI.dll
    Syntax
    public static class VisualTree : Object

    Methods

    FindAscendant(DependencyObject, Type)

    Find first visual ascendant control of a specified type.

    Declaration
    public static object FindAscendant(this DependencyObject element, Type type)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Child element.

    System.Type type

    Type of ascendant to look for.

    Returns
    Type Description
    System.Object

    Ascendant control or null if not found.

    FindAscendant<T>(DependencyObject)

    Find first visual ascendant control of a specified type.

    Declaration
    public static T FindAscendant<T>(this DependencyObject element)
        where T : DependencyObject
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Child element.

    Returns
    Type Description
    T

    Ascendant control or null if not found.

    Type Parameters
    Name Description
    T

    Type to search for.

    FindAscendantByName(DependencyObject, String)

    Find visual ascendant Microsoft.UI.Xaml.FrameworkElement control using its name.

    Declaration
    public static FrameworkElement FindAscendantByName(this DependencyObject element, string name)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Parent element.

    System.String name

    Name of the control to find

    Returns
    Type Description
    Microsoft.UI.Xaml.FrameworkElement

    Descendant control or null if not found.

    FindAscendants(DependencyObject)

    Find all visual ascendants for the element.

    Declaration
    public static IEnumerable<DependencyObject> FindAscendants(this DependencyObject element)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Child element.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<Microsoft.UI.Xaml.DependencyObject>

    A collection of parent elements or null if none found.

    FindDescendant(DependencyObject, Type)

    Find first descendant control of a specified type.

    Declaration
    public static object FindDescendant(this DependencyObject element, Type type)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Parent element.

    System.Type type

    Type of descendant.

    Returns
    Type Description
    System.Object

    Descendant control or null if not found.

    FindDescendant<T>(DependencyObject)

    Find first descendant control of a specified type.

    Declaration
    public static T FindDescendant<T>(this DependencyObject element)
        where T : DependencyObject
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Parent element.

    Returns
    Type Description
    T

    Descendant control or null if not found.

    Type Parameters
    Name Description
    T

    Type to search for.

    FindDescendantByName(DependencyObject, String)

    Find descendant Microsoft.UI.Xaml.FrameworkElement control using its name.

    Declaration
    public static FrameworkElement FindDescendantByName(this DependencyObject element, string name)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Parent element.

    System.String name

    Name of the control to find

    Returns
    Type Description
    Microsoft.UI.Xaml.FrameworkElement

    Descendant control or null if not found.

    FindDescendantByName<T>(DependencyObject, String)

    Find the first child control of the specified type using its name.

    Declaration
    public static T FindDescendantByName<T>(DependencyObject element, string name)
        where T : DependencyObject
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Parent element.

    System.String name

    Name of the control to find.

    Returns
    Type Description
    T

    Descendant control or null if not found.

    Type Parameters
    Name Description
    T

    Type to search for.

    FindDescendants<T>(DependencyObject)

    Find all descendant controls of the specified type.

    Declaration
    public static IEnumerable<T> FindDescendants<T>(this DependencyObject element)
        where T : DependencyObject
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyObject element

    Parent element.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    Descendant controls or empty if not found.

    Type Parameters
    Name Description
    T

    Type to search for.

    GetNavigableDescendants(UIElement)

    Find all the descendant controls that can be navigated on tab key navigation.

    Declaration
    public static List<UIElement> GetNavigableDescendants(UIElement element)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.UIElement element

    Parent element.

    Returns
    Type Description
    System.Collections.Generic.List<Microsoft.UI.Xaml.UIElement>

    Returns a list of descendant controls that can be navigated on tab key navigation

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved