We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The WPF TreeView control is a hierarchical list view that represents hierarchical data in a tree-like structure with expand and collapse node options. The control provides an optimized reuse strategy, smooth scrolling experience, and virtualization. It makes illustrating an office hierarchy, organizational structure, or nested relationships in an application easy to do. The control’s performance is enhanced with features like data binding, unbound node population, template selector, drag and drop, selection with different selection modes, complete UI customization, and commands for MVVM.


Data binding

The WPF TreeView control supports both ItemsSource binding and unbound node population. Easily customize the TreeView control as a navigation control by populating nodes in unbound mode. The layout can be easily defined in XAML. In addition, you can use all the properties and commands of the WPF TreeView in the MVVM approach.

WPF TreeView DataBinding


Load on demand

TreeView has a load-on-demand option that allows you to load huge amounts of data dynamically with a loading indicator, which improves the control’s performance.

WPF TreeView LoadOnDemand


Template

The WPF TreeView control allows you to customize an entire tree’s nodes by hosting any image or custom view using a template. The control supports customizing each node (both parent and child nodes) through dynamic selection of the UI using a data template selector.

WPF TreeView Item Template


Selection

  • Built-in support for selection with single, single-deselect, multiple, extended, and none select modes.
  • Background colors can be applied to selected items.
  • Support for keyboard navigation selection.

WPF TreeView Select Multiple Items


Editing

  • Embed any control to view or edit the data in a node.
  • Built-in editing support when the data is populated in an unbound mode. When entering into the edit mode, the node displays a TextBox.

WPF TreeView Editing Nodes


Add Image to tree node

Tree nodes are assigned images using ItemTemplate or using ItemTemplateSelector if images need to be loaded based on specific constraints.

WPF TreeView item with image


Animation

The WPF TreeView provides animation support when expanding or collapsing the TreeView nodes.

WPF TreeView Animation


Check box

Add check boxes to each tree node and check or clear the corresponding node. Nodes related to a parent node can be checked all at once by clicking the check box in the parent node.

WPF TreeView with CheckBox


Auto-size tree nodes

Automatically size the tree node height based on the node’s content to enhance content readability. Additionally, you can set the height of the tree node to one level or one node conditionally.

WPF TreeView Auto Fit Node Height


Expand and collapse

The WPF TreeView allows you to expand and collapse the nodes by user interaction on the expander icon, built-in commands, or programmatically.


Scrolling in TreeView

The TreeView provides various options to scroll programmatically. Virtual scrolling improves the performance when displaying large numbers of tree nodes.


Drag and drop

The WPF TreeView provides built-in drag-and-drop support to allow end users to rearrange nodes. It also supports dragging and dropping nodes between TreeViews or another external control.

WPF TreeView Drag and Drop


Context menu and command

Display the context menu on right clicking a node. Use the built-in RoutedUICommands to handle the context menu, edit a node, and delete one or more selected nodes.

WPF TreeView Context Menu


Appearance

WPF TreeView Expander Style

Expander customization

Provides a customizable expander UI, including size customization, for creating an elegant look and feel.

WPF TreeView Indent

Indentation

Specify the required indentation space for child nodes in the WPF TreeView control.

WPF TreeView Tree Lines

Root tree lines

Show a line between the tree nodes. Also, you can decide whether lines should be drawn between the tree nodes at the root of the WPF TreeView control.


WPF TreeView Code Example

Easily get started with the WPF TreeView using a few simple lines of XAML or C# code example as demonstrated below. Also explore our WPF Tree View Example that shows you how to render and configure the Tree View in WPF.

<Window x:Class="GettingStarted.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:GettingStarted"
        xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <syncfusion:SfTreeView x:Name="treeView" />
    </Grid>
</Window>
using Syncfusion.UI.Xaml.TreeView;
using System.Windows;
namespace GettingStarted
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            SfTreeView treeView = new SfTreeView();
            Root_Grid.Children.Add(treeView);
        }
    }
}



95+ WPF CONTROLS

Frequently Asked Questions

  • Display hierarchical data like an organizational structure and nested relationships in an application.
  • Easily customize the appearance of tree nodes, expanders, and selections. Includes essential features: selection with modes and template selector for each node.
  • Drag and drop tree nodes within the TreeView or from external controls.
  • Load the nodes on demand when the end user expands the node.
  • Select nodes with different selection modes and keyboard navigation.
  • Completely customize the UI using a template and template selectors.
  • Interact with the software using rich UI interaction and keyboard navigation.
  • Work with a simple configuration and API.
  • Use touch-friendly and responsive features.
  • Learn quickly and get started with WPF TreeView using its extensive demos and documentation.

You can find our WPF TreeView demo on

GitHub location.

App center location.

Microsoft location.

No, this is a commercial product and requires a paid license. However, a free community license is also available for companies and individuals whose organizations have less than $1 million USD in annual gross revenue, 5 or fewer developers, and 10 or fewer total employees.

A good place to start would be our comprehensive getting started documentation.

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Transform your applications today by downloading our free evaluation version
Download Free Trial No credit card required.

Syncfusion WPF Resources

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Up arrow icon