title: Column Header for a WPF TreeView
body: <p>I am using the WPF TreeView to display some hierarchical information. Each item in the TreeView consists of several attributes, so I am using a Grid within my HierarchicalDataTemplate to display these attributes:</p>
  
  <pre><code>&lt;HierarchicalDataTemplate x:Key="ArtistTemplate"
      ItemsSource="{Binding XPath=Title}"
      ItemTemplate="{StaticResource TitleTemplate}"&gt;
  
      &lt;Grid&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition SharedSizeGroup="NameColumn" /&gt;
              &lt;ColumnDefinition SharedSizeGroup="GenreColumn" /&gt;
              &lt;ColumnDefinition SharedSizeGroup="BornColumn" /&gt;
              &lt;ColumnDefinition SharedSizeGroup="DiedColumn" /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
  
          &lt;TextBlock Grid.Column="0" Text="{Binding XPath=@Name}" /&gt;
          &lt;TextBlock Grid.Column="1" Text="{Binding XPath=@Genre}" /&gt;
          &lt;TextBlock Grid.Column="2" Text="{Binding XPath=@Born}" /&gt;
          &lt;TextBlock Grid.Column="3" Text="{Binding XPath=@Died}" /&gt;
      &lt;/Grid&gt;
  
  &lt;/HierarchicalDataTemplate&gt;
  </code></pre>
  
  <p>This displays as a nice TreeView with 4 columns - so far so good! The only additional thing I need is a header above the TreeView that displays column names. The header column widths should be synchronized with TreeViewItems and also the header styles should be customizable. What's the easiest way to do this?</p>
  
  <p>P.S. I found two solutions that came close:</p>
  
  <p>1) A TreeListView <a href="http://www.codeproject.com/KB/WPF/wpf_treelistview_control.aspx" rel="noreferrer">here</a>, but this requires me to implement a custom interface (ITreeModel) to my model. Also the approach in this solution is to start with a ListView and to implement a RowExpander manually. In my case, the TreeView is sufficiently close to what I need, so I am hoping that putting a header on it should be very simple.</p>
  
  <p>2) A TreeListView <a href="http://blogs.windowsclient.net/ricciolocristian/archive/2008/03/22/a-complete-wpf-treelistview-control.aspx" rel="noreferrer">here</a>. This one indeed starts with a TreeView, but I can't figure out how to customize the header. I suspect that I have to customize the GridViewHeaderRowPresenter in the generic.xaml, but this element does not seem to have its own ControlTemplate.</p>