title: Checkbox in header will be checked if all child checkboxes are checked and unchecked when even one of them is unchecked in C# Desktop Application
body: <p>I have a datagridview in C# .net Windows Application where one checkbox column is there and i have added a header checkbox .</p>
  
  <p>code for adding a header checkbox and checkbox column is</p>
  
  <pre><code>DataGridViewCheckBoxColumn c1;
  CheckBox ckBox;
  
  private void CheckboxSelect_Load(object sender, EventArgs e)
  {
  c1 = new DataGridViewCheckBoxColumn();
  c1.Name = "selection";
  c1.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
  
  this.dgvSelectAll.Columns.Add(c1);
  this.dgvSelectAll.Rows.Add();
  this.dgvSelectAll.Rows.Add();
  this.dgvSelectAll.Rows.Add();
  this.dgvSelectAll.Rows.Add();
  
  ckBox = new CheckBox();
  Rectangle rect =this.dgvSelectAll.GetCellDisplayRectangle(0, -1, true);
  ckBox.Size = new Size(18, 18);
  ckBox.Location = rect.Location;
  this.dgvSelectAll.Controls.Add(ckBox);
  }
  </code></pre>
  
  <p>Is it possible If All check boxes are checked then header Checkbox will be checked and among the checked checkboxes one is unchecked then header will be unchecked in C#.Net Windows Application??</p>