title: wpf datagrid checkbox column header de/selects all
body: <p>I'm trying to create a datagrid with a checkbox column that has a header with a checkbox that selects and deselects the rows' checkboxes. Also I'm attempting to do it with no behind code.
  So far I've been partialy successful in that I used the datagrid's tag as a middle man in the binding, and could de/select the rows' checkboxes from the header checkbox using data triggers but once I check a row the binding in that row 'dies' and it is no longer effected by the header. Also, I already tried it with one way bindings instead of data triggers and got the same result...
  Does anyone know of a way to keep the binding alive or pheraps another to achive the effect I'm looking for inxaml only.</p>
  
  <p>header:</p>
  
  <pre><code>&lt;CheckBox IsChecked="{binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}, Path=Tag}"/&gt;
  </code></pre>
  
  <p>column template:</p>
  
  <pre><code>&lt;CheckBox&gt;
      &lt;CheckBox.Style&gt;
          &lt;Style TargetType="{x:Type CheckBox}"&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}, Path=Tag}" Value="True"&gt;
                      &lt;Setter Property="IsChecked" Value="True"/&gt;
                  &lt;/DataTrigger&gt;
                  &lt;DataTrigger Binding="{binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}, Path=Tag}" Value="False"&gt;
                      &lt;Setter Property="IsChecked" Value="False"/&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/CheckBox.Style&gt;
  &lt;/CheckBox&gt;
  </code></pre>