title: Datagrid Column header should check / uncheck CheckBox’s state depending upon whether all CheckBoxes of a DataGridView column are checked or unchecked
body: <p><img src="https://i.stack.imgur.com/ee5C1.jpg" alt="enter image description here"> The problem i'm stuck with is related to checkbox in DataGrid(WPF). I've attached the screenshot for better understanding of the problem. </p>
  
  <p>Problem: The DataHeader Column Checkbox is checked even when one of the child is Unchecked. I expect the solution to fix this so that when one of the child is unchecked explicitly by the user, The ALL(Column Header) should be unchecked implicitly.</p>
  
  <p>Please help guys... Thank You
  Plz check the link. i want the solution to work like this. <a href="http://www.codeproject.com/Articles/42437/Toggling-the-States-of-all-CheckBoxes-Inside-a-Dat#" rel="noreferrer">http://www.codeproject.com/Articles/42437/Toggling-the-States-of-all-CheckBoxes-Inside-a-Dat#</a></p>
  
  <pre><code>&lt;dg:DataGrid.Columns&gt;
      &lt;dg:DataGridCheckBoxColumn Binding="{Binding Check}" IsThreeState="True" Width="50"&gt;
          &lt;dg:DataGridCheckBoxColumn.HeaderTemplate&gt;
              &lt;DataTemplate x:Name="dtAllChkBx"&gt;
                  &lt;CheckBox Name="cbxAll" Content="{x:Static properties:Resources.lblAll}"
                            Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" /&gt;
              &lt;/DataTemplate&gt;
          &lt;/dg:DataGridCheckBoxColumn.HeaderTemplate&gt;
      &lt;/dg:DataGridCheckBoxColumn&gt;
  </code></pre>
  
  <p>.</p>
  
  <pre><code>private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
  {
      unchck_all_prd();
      dgEnggAcc.Items.Refresh();
  }
  
  private void unchck_all_prd()
  {
      for (int i = 0; i &lt; engg_list.Count; i++)
      {
          engg_list[i].Check = false;
      }
  }
  
  private void chck_all_prd()
  {
      for (int i = 0; i &lt; engg_list.Count; i++)
      {
          engg_list[i].Check = true;
      }
  }
  
  public class EnggLst : ObservableCollection&lt;EnggLst&gt;
  {
      public bool Check { get; set; }
  }
  </code></pre>