title: Problems with DataContext and DataGridTemplateColumn
body: <p>I am using a <code>DataGridTemplateColumn</code> to show a CheckBox in the Header. The Checkbox is used to show if alle cells are <code>checked</code> and to (un-)check all cells.</p>
  <p>XAML:</p>
  <pre><code>    &lt;DataGridTemplateColumn&gt;
                  &lt;DataGridTemplateColumn.Header&gt;
                      &lt;CheckBox IsChecked=&quot;{Binding Path=DataContext.AreAllVehiclesChecked, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl, AncestorLevel=1}}&quot; Command=&quot;{Binding Path=DataContext.ChangeAllItemsSelectedCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl,AncestorLevel=1}}&quot; IsThreeState=&quot;False&quot; /&gt;   
                      &lt;/DataGridTemplateColumn.Header&gt;
                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;CheckBox IsChecked=&quot;{Binding IsSelected, Mode=TwoWay}&quot; Command=&quot;{Binding Path=DataContext.ChangeItemSelectionCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl,AncestorLevel=1}}&quot; CommandParameter=&quot;{Binding }&quot;&gt;&lt;/CheckBox&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
              &lt;/DataGridTemplateColumn&gt;
  </code></pre>
  <p>Error Message:</p>
  <blockquote>
  <p>System.Windows.Data Error: 40 : BindingExpression path error: 'IsSearchSelected' property not found on 'object' ''CheckBox' (Name='')'. BindingExpression:Path=IsSearchSelected; DataItem='CheckBox' (Name=''); target element is 'CheckBox' (Name=''); target property is 'IsChecked' (type 'Nullable`1')</p>
  <p>System.Windows.Data Error: 40 : BindingExpression path error: 'CreateProjectFromSelectedVehiclesDemandedCommand' property not found on 'object' ''CheckBox' (Name='')'. BindingExpression:Path=CreateProjectFromSelectedVehiclesDemandedCommand; DataItem='CheckBox' (Name=''); target element is 'CheckBox' (Name=''); target property is 'Command' (type 'ICommand')</p>
  </blockquote>
  <p>What bugs me like hell is taht the DataTemplate with the CheckBox for all single cells is working just fine. The Property and the command are correctly bound. What doesn't work is the checkbox in the header. I have (the very same structure) correctly running in another project.</p>
  <p>Any ideas what I am doing wrong?</p>
  <p><strong>UPDATE:</strong> I tried it again this morning (because of using snoop etc.) and suddenly - without changing code - it works (again). What's the best-StackOverflow-practice here -&gt; Deleting the question?</p>
  <p>Thanks again to everyone who was trying to help me!</p>