Index: Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs =================================================================== diff -u -rc282e767cf740d6fc47b4082a51a5f12f6fa2e3b -r3a6559edf6580a3c02e963c5ea2ee12f4bfec247 --- Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs (.../DataGridViewControl.cs) (revision c282e767cf740d6fc47b4082a51a5f12f6fa2e3b) +++ Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs (.../DataGridViewControl.cs) (revision 3a6559edf6580a3c02e963c5ea2ee12f4bfec247) @@ -360,24 +360,6 @@ } /// - /// Add a handler for the event. - /// - /// The handler to add. - public void AddCellClickHandler(DataGridViewCellEventHandler handler) - { - dataGridView.CellClick += handler; - } - - /// - /// Remove a handler from the event. - /// - /// The handler to remove. - public void RemoveCellClickHandler(DataGridViewCellEventHandler handler) - { - dataGridView.CellClick -= handler; - } - - /// /// Add a handler for the event. /// /// The handler to add. Index: Core/Common/src/Core.Common.Gui/GuiCore.cs =================================================================== diff -u -r7138fe56ae58f925e7726c6cae6ddd175baf001e -r3a6559edf6580a3c02e963c5ea2ee12f4bfec247 --- Core/Common/src/Core.Common.Gui/GuiCore.cs (.../GuiCore.cs) (revision 7138fe56ae58f925e7726c6cae6ddd175baf001e) +++ Core/Common/src/Core.Common.Gui/GuiCore.cs (.../GuiCore.cs) (revision 3a6559edf6580a3c02e963c5ea2ee12f4bfec247) @@ -511,6 +511,8 @@ { selectionProviders.Add(selectionProvider); selectionProvider.SelectionChanged += OnSelectionChanged; + + Selection = selectionProvider.Selection; } } Index: Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs =================================================================== diff -u -rc282e767cf740d6fc47b4082a51a5f12f6fa2e3b -r3a6559edf6580a3c02e963c5ea2ee12f4bfec247 --- Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs (.../DataGridViewControlTest.cs) (revision c282e767cf740d6fc47b4082a51a5f12f6fa2e3b) +++ Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs (.../DataGridViewControlTest.cs) (revision 3a6559edf6580a3c02e963c5ea2ee12f4bfec247) @@ -1222,85 +1222,6 @@ } [Test] - public void AddCellClickHandler_Always_AddsEventHandler() - { - // Setup - using (var form = new Form()) - using (var control = new DataGridViewControl()) - { - form.Controls.Add(control); - form.Show(); - - var gridTester = new ControlTester("dataGridView"); - var dataGridView = (DataGridView) gridTester.TheObject; - - control.AddTextBoxColumn("Test property", "Test header"); - - dataGridView.DataSource = new[] - { - "" - }; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[0]; - dataGridView.CurrentCell = dataGridViewCell; - - int counter = 0; - - control.AddCellClickHandler((sender, args) => counter++); - - // Precondition - Assert.AreEqual(0, counter); - - // Call - gridTester.FireEvent("CellClick", new DataGridViewCellEventArgs(0, 0)); - - // Assert - Assert.AreEqual(1, counter); - } - } - - [Test] - public void RemoveCellClickHandler_Always_RemovesEventHandler() - { - // Setup - using (var form = new Form()) - using (var control = new DataGridViewControl()) - { - form.Controls.Add(control); - form.Show(); - - var gridTester = new ControlTester("dataGridView"); - var dataGridView = (DataGridView) gridTester.TheObject; - - control.AddTextBoxColumn("Test property", "Test header"); - - dataGridView.DataSource = new[] - { - "" - }; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[0]; - dataGridView.CurrentCell = dataGridViewCell; - - int counter = 0; - - DataGridViewCellEventHandler dataGridViewCellEventHandler = (sender, args) => counter++; - - control.AddCellClickHandler(dataGridViewCellEventHandler); - - // Precondition - Assert.AreEqual(0, counter); - gridTester.FireEvent("CellClick", new DataGridViewCellEventArgs(0, 0)); - Assert.AreEqual(1, counter); - - // Call - control.RemoveCellClickHandler(dataGridViewCellEventHandler); - gridTester.FireEvent("CellClick", new DataGridViewCellEventArgs(0, 0)); - - // Assert - Assert.AreEqual(1, counter); - } - } - - [Test] public void AddCurrentCellChangedHandler_Always_AddsEventHandler() { // Setup @@ -1322,7 +1243,7 @@ Assert.AreEqual(1, counter); } } - + [Test] public void RemoveCurrentCellChangedHandler_Always_RemovesEventHandler() { @@ -1354,7 +1275,6 @@ } } - [Test] public void AddCellValueChangedHandler_Always_AddsEventHandler() { Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs =================================================================== diff -u -r71d948806b73fcf679975dfb8b9847edd46d61d3 -r3a6559edf6580a3c02e963c5ea2ee12f4bfec247 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 71d948806b73fcf679975dfb8b9847edd46d61d3) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 3a6559edf6580a3c02e963c5ea2ee12f4bfec247) @@ -188,7 +188,7 @@ private void InitializeDataGridView() { - dataGridViewControl.AddCellClickHandler(DataGridViewOnCellClick); + dataGridViewControl.AddCurrentCellChangedHandler(DataGridViewOnCurrentCellChanged); dataGridViewControl.AddCellFormattingHandler(OnCellFormatting); dataGridViewControl.AddTextBoxColumn( @@ -580,7 +580,7 @@ #region Event handling - private void DataGridViewOnCellClick(object sender, DataGridViewCellEventArgs e) + private void DataGridViewOnCurrentCellChanged(object sender, EventArgs e) { if (updatingDataSource) {