I'm using WPF TreeView to display some hierarchical information Each item in TreeView contains many attributes, Therefore, I am using the grid within my hierarchical data template to display these properties:
& lt; HierarchicalDataTemplate x: key = "ArtistTemplate" ItemsSource = "{Binding XPath = Title}" item template = "{staticroso serial template}" & gt; & Lt; Grid & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; Column Definition Shared GroupGranian = "Name Columns" / & gt; & Lt; Column Definition Shared Group = "GenreColumn" /> & Lt; Calligraphy shyrsisgup = "birth column" /> & Lt; Columns Definition Shared Group = "Combat Columns" / & gt; & Lt; /Grid.ColumnDefinitions> & Lt; Text block grid Column = "0" text = "{binding XPath = @ name}" /> & Lt; Text block grid Column = "1" text = "{binding XPath = @ genre}" /> & Lt; Text block grid Column = "2" text = "{binding XPath = @ birth}" /> & Lt; Text block grid Column = "3" text = "{binding XPath = @ dead}" /> & Lt; / Grid & gt; & Lt; / HierarchicalDataTemplate & gt;
It displays as a nice TreeView with 4 columns - so far so good! I need only one extra thing on the top of the treeview, the header which displays the column name. The header column width should be synchronized with TreeViewItems and the header style should be customizable. What is the easiest way to do this?
PS I got two solutions that came near:
1) A trilistview, but for that I have to implement a custom interface (ATMModel) for my model. Also in this solution, start with a ListView from the perspective and apply a RowExpander manually. In my case, TreeView is close enough for what is necessary for me, so I hope that it should be very easy to put a header on it.
2) A TreeListView This really starts with a TreeView, but I can not understand how to customize the headers. I suspect that I have to customize GridViewHeaderRowPresenter in generic.xaml, but this element does not have its ControlTemplate.
Well, I found a solution that completely meets my needs!
Comments
Post a Comment