private void BranchGrid_CurrentCellDirtyStateChanged(object sender, EventArgs e) { // Push grid checkbox changes immediately into the underlying data table. if (BranchGrid.CurrentCell is DataGridViewCheckBoxCell) { BranchGrid.EndEdit(); ((BindingSource)BranchGrid.DataSource).EndEdit(); } }
private void SetBranchesPushCheckboxesState(Func <DataGridViewRow, bool> willPush) { // Necessary to end the edit mode of the Cell. BranchGrid.EndEdit(); foreach (DataGridViewRow row in BranchGrid.Rows) { var pushCheckBox = row.Cells[PushColumn.Name] as DataGridViewCheckBoxCell; if (pushCheckBox == null || !pushCheckBox.Visible) { continue; } pushCheckBox.Value = willPush(row); } }