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.
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.
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.
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.
Tree nodes are assigned images using ItemTemplate or using ItemTemplateSelector if images need to be loaded based on specific constraints.
The WPF TreeView provides animation support when expanding or collapsing the TreeView nodes.
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.
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.
The WPF TreeView allows you to expand and collapse the nodes by user interaction on the expander icon, built-in commands, or programmatically.
The TreeView provides various options to scroll programmatically. Virtual scrolling improves the performance when displaying large numbers of tree nodes.
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.
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.
Provides a customizable expander UI, including size customization, for creating an elegant look and feel.
Specify the required indentation space for child nodes in the WPF TreeView control.
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.
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);
}
}
}
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.
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.