Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs =================================================================== diff -u -r29fa3a5e54e1ba71a95a4405088a8a5b87c7b3c8 -r5562ec9835fa2ad44ede7aa031e80c3e9a368445 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs (.../AssemblyResultTotalView.cs) (revision 29fa3a5e54e1ba71a95a4405088a8a5b87c7b3c8) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs (.../AssemblyResultTotalView.cs) (revision 5562ec9835fa2ad44ede7aa031e80c3e9a368445) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Windows.Forms; +using Core.Common.Controls.DataGrid; using Core.Common.Controls.Views; using Core.Common.Util.Extensions; using Ringtoets.ClosingStructures.Data; @@ -67,8 +68,6 @@ AssessmentSection = assessmentSection; InitializeComponent(); - LocalizeControl(); - InitializeDataGridView(); } /// @@ -78,6 +77,27 @@ public object Data { get; set; } + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + LocalizeControl(); + InitializeDataGridView(); + + dataGridViewControl.CellFormatting += HandleCellStyling; + } + + protected override void Dispose(bool disposing) + { + dataGridViewControl.CellFormatting -= HandleCellStyling; + + if (disposing) + { + components?.Dispose(); + } + base.Dispose(disposing); + } + private void LocalizeControl() { RefreshAssemblyResultsButton.Text = Resources.AssemblyResultTotalView_RefreshAssemblyResultsButton_Text; @@ -141,6 +161,22 @@ dataGridViewControl.RefreshDataGridView(); } + private void HandleCellStyling(object sender, DataGridViewCellFormattingEventArgs e) + { + var row = (FailureMechanismAssemblyResultRowBase) dataGridViewControl.GetRowFromIndex(e.RowIndex).DataBoundItem; + + if (row.ColumnStateDefinitions.ContainsKey(e.ColumnIndex)) + { + DataGridViewColumnStateDefinition columnStateDefinition = row.ColumnStateDefinitions[e.ColumnIndex]; + DataGridViewCell cell = dataGridViewControl.GetCell(e.RowIndex, e.ColumnIndex); + + cell.ReadOnly = columnStateDefinition.ReadOnly; + cell.ErrorText = columnStateDefinition.ErrorText; + cell.Style.BackColor = columnStateDefinition.Style.BackgroundColor; + cell.Style.ForeColor = columnStateDefinition.Style.TextColor; + } + } + #region Failure mechanism assembly result rows #region Group 1