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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to bind hierarchical data in multiple columns using TreeViewAdv control?

Platform: WPF |
Control: TreeViewAdv |
Published Date: November 14, 2016 |
Last Revised Date: November 14, 2016

This article describes how to bind hierarchical data in multiple columns using TreeViewAdv control. Follow the below steps to populate TreeViewAdv control with hierarchical multiple column data.

Enable multiple columns

Set the property MultiColumnEnable of TreeViewAdv to enable multiple columns support in TreeViewAdv control.

Add columns

Add the required number of TreeViewColumn to the TreeViewColumnCollection and set it to the Columns property of TreeViewAdv control.

Column Header

Set header for each TreeViewColumn using its Header property.

Column CellTemplate

Set data template property for each TreeViewColumn using its CellTemplate property.

Set ItemTemplate

Use HierarchicalDataTemplate instead of DataTemplate to set ItemTemplate property of TreeViewAdv control, because DataTemplate cannot render hierarchical data. ItemsControl property of HierarchicalDataTemplate must be set, since it indicates where to find the collection that represents the next level in the data hierarchy.

The following code example demonstrates the same.

C#

 

XAML

 

The following screenshot illustrates the output.

Figure 1:  Child nodes expanded from parent node in TreeViewAdv

 

 

 

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon