private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex == selectableHydraulicBoundaryLocationColumnIndex) { DataGridViewRow dataGridViewRow = DataGridViewControl.GetRowFromIndex(eventArgs.RowIndex); dataGridViewRow.Cells[selectableHydraulicBoundaryLocationColumnIndex].ReadOnly = dataGridViewRow.DataBoundItem is MacroStabilityInwardsCalculationRow dataItem && dataItem.Calculation.InputParameters.UseAssessmentLevelManualInput; } }