This example demonstrates how to use the HierarchicalDataTemplate to apply a custom appearance to hierarchical data.
-
If all objects have the same field that contains child nodes, create a hierarchical data template and assign it to the TreeListView.DataRowTemplate property. You can also put hierarchical data templates into resources.
-
Specify the data type to which the template should be applied:
<Window.Resources> <HierarchicalDataTemplate DataType="{x:Type local:ProjectObject}" ItemsSource="{Binding Stages}"/> <HierarchicalDataTemplate DataType="{x:Type local:ProjectStage}" ItemsSource="{Binding Tasks}"/> </Window.Resources>
-
Set the TreeListView.TreeDerivationMode property to
HierarchicalDataTemplate
.
- MainWindow.xaml (VB: MainWindow.xaml)
- ViewModel.cs (VB: ViewModel.vb)
- WPF Tree List - Use the Child Nodes Selector to Display Hierarchical Data
- WPF Tree List - Implement the Child Nodes Path
- WPF Tree List - Bind to Self-Referential Data Structure
(you will be redirected to DevExpress.com to submit your response)