title: WPF TreeViewItem Header Value After DataBinding
body: <p>I have a TreeView whose contents (nested TreeViewItems) are generated from a dataset via databinding, which all seems to work fine. The issue I'm running into is that when I try and manipulate the contents of the TreeViewItem headers in code, the Header property returns the DataRowView that the TreeViewItem was generated from and not, as I was expecting, the control generated by the template.</p>
  
  <p>Here's an example of the template I'm using to generate the TreeViewItems:</p>
  
  <pre><code>    &lt;DataTemplate x:Key="seasonTreeViewItemTemplate"&gt;
          &lt;TreeViewItem&gt;
              &lt;TreeViewItem.Header&gt;
                  &lt;CheckBox Content="{Binding Path=Row.SeasonID}" Tag="{Binding}" ToolTip="{Binding Path=Row.Title}" IsEnabled="{StaticResource seasonPermitted}" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" /&gt;
              &lt;/TreeViewItem.Header&gt;
  
              &lt;TreeViewItem Header="Championships" ItemTemplate="{StaticResource championshipTreeViewItemTemplate}"&gt;
                  &lt;TreeViewItem.ItemsSource&gt;
                      &lt;Binding Path="Row" ConverterParameter="FK_Championship_Season"&gt;
                          &lt;Binding.Converter&gt;
                              &lt;local:RowChildrenConverter /&gt;
                          &lt;/Binding.Converter&gt;
                      &lt;/Binding&gt;
                  &lt;/TreeViewItem.ItemsSource&gt;
              &lt;/TreeViewItem&gt;
          &lt;/TreeViewItem&gt;
      &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>Can anyone point out where I'm going wrong and advise me how to access the header checkboxes (ideally without delving into the VisualTree if possible)?</p>
  
  <p>Thanks,
  James</p>