title: Custom Datagrid column header
body: <p>I'm Trying to create a datagrid with custom column headers with images.
  The problem is that the binding is not working properly.</p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;DataTemplate x:Key="header"&gt;
          &lt;Image Source="{Binding ColumnHeader}"/&gt;
      &lt;/DataTemplate&gt;
  
      &lt;DataGridRowHeader x:Key="Row"/&gt;
      &lt;DataTemplate x:Key="RowHeaderTemplate"&gt;
          &lt;Grid&gt;
              &lt;TextBlock TextWrapping="Wrap" Text="Text"/&gt;
          &lt;/Grid&gt;
      &lt;/DataTemplate&gt;
      &lt;Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}"&gt;
          &lt;Setter Property="Width" Value="8"/&gt;
          &lt;Setter Property="Background" Value="Transparent"/&gt;
          &lt;Setter Property="Cursor" Value="SizeWE"/&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type Thumb}"&gt;
                      &lt;Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
      &lt;Style x:Key="DataGridColumnHeaderStyle1" TargetType="{x:Type DataGridColumnHeader}"&gt;
          &lt;Setter Property="VerticalContentAlignment" Value="Center"/&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type DataGridColumnHeader}"&gt;
                      &lt;Grid&gt;
                          &lt;Microsoft_Windows_Themes:DataGridHeaderBorder BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" IsClickable="{TemplateBinding CanUserSort}" IsPressed="{TemplateBinding IsPressed}" IsHovered="{TemplateBinding IsMouseOver}" Padding="{TemplateBinding Padding}" SortDirection="{TemplateBinding SortDirection}" SeparatorBrush="{TemplateBinding SeparatorBrush}" SeparatorVisibility="{TemplateBinding SeparatorVisibility}" ThemeColor="NormalColor"&gt;
                              &lt;TextBlock Text="{Binding Path=ColumnHeader}"/&gt;
                          &lt;/Microsoft_Windows_Themes:DataGridHeaderBorder&gt;
                          &lt;Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{StaticResource ColumnHeaderGripperStyle}"/&gt;
                          &lt;Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource ColumnHeaderGripperStyle}"/&gt;
                      &lt;/Grid&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
      &lt;/Window.Resources&gt;
  &lt;Grid x:Name="LayoutRoot"&gt;
      &lt;DataGrid x:Name="dataGrid" ItemsSource="{Binding}" RowHeaderTemplate="{DynamicResource RowHeaderTemplate}" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle1}"/&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>For testing purposes i replaced the image control with a plain textblock.</p>
  
  <p>EDIT:
  The datagrid datacontext is set to a datatable</p>
  
  <p>Can anybody help me?</p>
  
  <p>Thanks.</p>