Skip to content

DevExpress-Examples/wpf-treelist-use-hierarchical-data-templates-to-build-a-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPF Tree List - Use the Hierarchical Data Template to Build a Tree

This example demonstrates how to use the HierarchicalDataTemplate to apply a custom appearance to hierarchical data.

image

  1. 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.

  2. 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>
  3. Set the TreeListView.TreeDerivationMode property to HierarchicalDataTemplate.

Files to Review

Documentation

More Examples

About

Use the HierarchicalDataTemplate to apply a custom appearance to hierarchical data.

Topics

Resources

License

Stars

Watchers

Forks