I have some hierarchical data that I need display as a table, can I change the style of a TreeView to display the data in List-like manner ?
so instead of:
+Group1
SubItem1
SubItem2
+Group2
+Group
SubItem11
SubItem12
I want this:
Group1
SubItem1
SubItem2
Group2
Group
SubItem11
SubItem12
My code looks like this:
<TreeView ItemsSource="{Binding RootItems}"
dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="true" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type vm:CategoryViewModel}"
ItemsSource="{Binding Children}">
<v:Category DataContext="{Binding}" />
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type vm:ItemViewModel}">
<v:Item DataContext="{Binding}" />
</DataTemplate>
</TreeView.Resources>
</TreeView>
I know I should probably be able to work with the style of the TreeView, but I don’t know where to start, and I couldn’t find any information in this direction.
NOTE: duplicate of Can I have a Treeview without the tree structure?
Override the
TreeViewItemtemplate, e.g.