private void BranchesGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { // track only “Deleted” column if (e.ColumnIndex != 0) { return; } BranchesGrid.CommitEdit(DataGridViewDataErrorContexts.Commit); lblStatus.Text = GetDefaultStatusText(); }
private void BranchesGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { // track only “Deleted” column, ignoring the checkbox header if (e.ColumnIndex != 0 || e.RowIndex == -1) { return; } BranchesGrid.CommitEdit(DataGridViewDataErrorContexts.Commit); checkBoxHeaderCell.Checked = _branches.All(b => b.Delete); lblStatus.Text = GetDefaultStatusText(); }
private void CheckBoxHeader_OnCheckBoxClicked(object sender, CheckBoxHeaderCellEventArgs e) { BranchesGrid.CommitEdit(DataGridViewDataErrorContexts.Commit); for (int i = 0; i < BranchesGrid.Rows.Count; i++) { DataGridViewRow row = BranchesGrid.Rows[i]; DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell)row.Cells[nameof(_NO_TRANSLATE_deleteDataGridViewCheckBoxColumn)]; cell.Value = e.Checked; } BranchesGrid.EndEdit(); }