Index: Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs
===================================================================
diff -u -rdd960f31f43361ef0a6cf6d0ccab755c697510c0 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs (.../DataGridViewControl.cs) (revision dd960f31f43361ef0a6cf6d0ccab755c697510c0)
+++ Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs (.../DataGridViewControl.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -34,6 +34,13 @@
public partial class DataGridViewControl : UserControl
{
///
+ /// Event handler that fires only when a new cell in a
+ /// row different from the previously selected row is
+ /// selected. Also fires if it's the first selection.
+ ///
+ private event EventHandler RowChanged;
+
+ ///
/// Creates a new instance of .
///
public DataGridViewControl()
@@ -42,6 +49,8 @@
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
SubscribeEvents();
+
+ LastSelectedRow = -1;
}
///
@@ -118,14 +127,30 @@
}
///
- /// Clears the current cell.
+ /// Integer containing the index of the previously selected
+ /// row.
///
+ public int LastSelectedRow { get; private set; }
+
+ ///
+ /// Clears the current cell and resets the last selected row
+ /// property to -1 (no previously selected row).
+ ///
public void ClearCurrentCell()
{
dataGridView.CurrentCell = null;
+ LastSelectedRow = -1;
}
///
+ /// Resets the last selected row property
+ ///
+ public void ResetLastSelectedRow()
+ {
+ LastSelectedRow = -1;
+ }
+
+ ///
/// Sets the currently active cell.
///
/// Sets the cell to be set active.
@@ -284,7 +309,16 @@
/// will clear the grid view.
public void SetDataSource(IList dataSource)
{
+ var handler = (EventHandler) RowChanged?.Clone();
+ RemoveCurrentRowChangedHandler(handler);
+
dataGridView.DataSource = dataSource;
+
+ AddCurrentRowChangedHandler(handler);
+ if (dataSource != null && dataSource.Count != 0)
+ {
+ RowChanged?.Invoke(this, EventArgs.Empty);
+ }
}
///
@@ -438,6 +472,48 @@
}
///
+ /// Add a handler for the event. event.
+ ///
+ /// The handler to add.
+ public void AddCurrentRowChangedHandler(EventHandler handler)
+ {
+ RowChanged += handler;
+ dataGridView.CurrentCellChanged += DataGridViewOnCurrentCellChanged;
+ }
+
+ ///
+ /// Remove the handler for the event.
+ /// The handler to remove.
+ ///
+ public void RemoveCurrentRowChangedHandler(EventHandler handler)
+ {
+ RowChanged -= handler;
+ dataGridView.CurrentCellChanged -= DataGridViewOnCurrentCellChanged;
+ }
+
+ private void DataGridViewOnCurrentCellChanged(object o, EventArgs eventArgs)
+ {
+ if (RowChanged == null)
+ {
+ return;
+ }
+
+ if (CurrentRow == null)
+ {
+ RowChanged.Invoke(o, eventArgs);
+ return;
+ }
+
+ if (LastSelectedRow == CurrentRow.Index)
+ {
+ return;
+ }
+
+ RowChanged.Invoke(o, eventArgs);
+ LastSelectedRow = CurrentRow.Index;
+ }
+
+ ///
/// Add a handler for the event.
///
/// The handler to add.
@@ -447,7 +523,7 @@
}
///
- /// Remove a handler for the event.
+ /// Add a handler for the event.
///
/// The handler to add.
public void RemoveCurrentCellChangedHandler(EventHandler handler)
@@ -550,7 +626,7 @@
DataGridViewCell currentCell = dataGridView.CurrentCell;
// End edits of current cell:
- dataGridView.CurrentCell = null; // Setting to null has side-effect of removing selection highlight
+ ClearCurrentCell();
// Restore selection highlight:
dataGridView.CurrentCell = currentCell;
Index: Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs
===================================================================
diff -u -rdd960f31f43361ef0a6cf6d0ccab755c697510c0 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs (.../DataGridViewControlTest.cs) (revision dd960f31f43361ef0a6cf6d0ccab755c697510c0)
+++ Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs (.../DataGridViewControlTest.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -55,6 +55,7 @@
Control dataGridView = control.Controls[0];
Assert.IsInstanceOf(dataGridView);
Assert.AreEqual(DockStyle.Fill, dataGridView.Dock);
+ Assert.AreEqual(-1, control.LastSelectedRow);
}
}
@@ -1053,7 +1054,7 @@
}
[Test]
- public void ClearCurrentCell_Always_SetsCurrentCellToNull()
+ public void ClearCurrentCell_Always_SetsCurrentCellToNullAndResetsLastSelectedRow()
{
// Setup
using (var form = new Form())
@@ -1080,6 +1081,7 @@
// Assert
Assert.IsNull(dataGridView.CurrentCell);
+ Assert.AreEqual(-1, control.LastSelectedRow);
}
}
@@ -1286,9 +1288,28 @@
TestRoundedDouble = testRoundedDouble;
}
+ // Property needs to have a setter, otherwise some tests will fail
public RoundedDouble TestRoundedDouble { get; set; }
}
+ private class TestDataGridViewMultipleRows
+ {
+ public TestDataGridViewMultipleRows(RoundedDouble testRoundedDouble)
+ {
+ TestRoundedDouble = testRoundedDouble;
+ }
+
+ public TestDataGridViewMultipleRows(RoundedDouble testRoundedDouble, string testString)
+ {
+ TestRoundedDouble = testRoundedDouble;
+ TestString = testString;
+ }
+
+ public RoundedDouble TestRoundedDouble { get; }
+
+ public string TestString { get; }
+ }
+
#region Event handling
[Test]
@@ -1362,6 +1383,77 @@
}
[Test]
+ public void AddCurrentRowChangedHandler_Always_AddsEventHandler()
+ {
+ // Setup
+ using (var form = new Form())
+ using (var control = new DataGridViewControl())
+ {
+ form.Controls.Add(control);
+ form.Show();
+
+ const double initialValue = 25;
+
+ control.AddTextBoxColumn("TestRoundedDouble", "Test header");
+
+ var gridTester = new ControlTester("dataGridView");
+
+ control.SetDataSource(new[]
+ {
+ new TestDataGridViewRow(new RoundedDouble(0, initialValue))
+ });
+
+ var counter = 0;
+ control.AddCurrentRowChangedHandler((sender, args) => counter++);
+
+ // Call
+ gridTester.FireEvent("CurrentCellChanged", new EventArgs());
+
+ // Assert
+ Assert.AreEqual(1, counter);
+ }
+ }
+
+ [Test]
+ public void RemoveCurrentRowChangedHandler_Always_RemovesEventHandler()
+ {
+ // Setup
+ using (var form = new Form())
+ using (var control = new DataGridViewControl())
+ {
+ form.Controls.Add(control);
+ form.Show();
+
+ const double initialValue = 25;
+
+ control.AddTextBoxColumn("TestRoundedDouble", "Test header");
+ var gridTester = new ControlTester("dataGridView");
+
+ control.SetDataSource(new[]
+ {
+ new TestDataGridViewRow(new RoundedDouble(0, initialValue))
+ });
+
+ var counter = 0;
+
+ EventHandler eventHandler = (sender, args) => counter++;
+ control.AddCurrentRowChangedHandler(eventHandler);
+
+ // Precondition
+ Assert.AreEqual(0, counter);
+ gridTester.FireEvent("CurrentCellChanged", new EventArgs());
+ Assert.AreEqual(1, counter);
+
+ // Call
+ control.RemoveCurrentRowChangedHandler(eventHandler);
+
+ // Assert
+ gridTester.FireEvent("CurrentCellChanged", new EventArgs());
+ Assert.AreEqual(1, counter);
+ }
+ }
+
+ [Test]
public void AddCurrentCellChangedHandler_Always_AddsEventHandler()
{
// Setup
@@ -1371,8 +1463,17 @@
form.Controls.Add(control);
form.Show();
+ const double initialValue = 25;
+
+ control.AddTextBoxColumn("TestRoundedDouble", "Test header");
+
var gridTester = new ControlTester("dataGridView");
+ control.SetDataSource(new[]
+ {
+ new TestDataGridViewRow(new RoundedDouble(0, initialValue))
+ });
+
var counter = 0;
control.AddCurrentCellChangedHandler((sender, args) => counter++);
@@ -1394,8 +1495,16 @@
form.Controls.Add(control);
form.Show();
+ const double initialValue = 25;
+
+ control.AddTextBoxColumn("TestRoundedDouble", "Test header");
var gridTester = new ControlTester("dataGridView");
+ control.SetDataSource(new[]
+ {
+ new TestDataGridViewRow(new RoundedDouble(0, initialValue))
+ });
+
var counter = 0;
EventHandler eventHandler = (sender, args) => counter++;
@@ -1702,6 +1811,106 @@
}
}
+ [Test]
+ public void CurrentCellChangedHandler_SelectedCellInNewRow_ExecuteEventHandler()
+ {
+ // Setup
+ using (var form = new Form())
+ using (var control = new DataGridViewControl())
+ {
+ form.Controls.Add(control);
+ form.Show();
+
+ control.AddTextBoxColumn("TestRoundedDouble", "Test header");
+ control.AddTextBoxColumn("TestString", "Test string header");
+ control.SetDataSource(new[]
+ {
+ new TestDataGridViewMultipleRows(new RoundedDouble(0, 2.5), "hello world"),
+ new TestDataGridViewMultipleRows(new RoundedDouble(0, 8.3), "test")
+ });
+ control.SetCurrentCell(control.GetCell(0, 0));
+
+ var handlerExecuted = false;
+ control.AddCurrentRowChangedHandler((sender, args) => handlerExecuted = true);
+
+ // Call
+ control.SetCurrentCell(control.GetCell(1, 0));
+
+ // Assert
+ Assert.IsTrue(handlerExecuted);
+ }
+ }
+
+ [Test]
+ public void CurrentCellChangedHandler_FirstSelection_ExecuteEventHandler()
+ {
+ // Setup
+ using (var form = new Form())
+ using (var control = new DataGridViewControl())
+ {
+ form.Controls.Add(control);
+ form.Show();
+
+ var gridTester = new ControlTester("dataGridView");
+
+ control.AddTextBoxColumn("TestRoundedDouble", "Test header");
+ control.AddTextBoxColumn("TestString", "Test string header");
+ control.SetDataSource(new[]
+ {
+ new TestDataGridViewMultipleRows(new RoundedDouble(0, 2.5), "hello world"),
+ new TestDataGridViewMultipleRows(new RoundedDouble(0, 8.3), "test")
+ });
+
+ var handlerExecuted = false;
+ control.AddCurrentRowChangedHandler((sender, args) => handlerExecuted = true);
+
+ // Call
+ control.SetCurrentCell(control.GetCell(0, 0));
+ gridTester.FireEvent("CurrentCellChanged", EventArgs.Empty);
+
+ // Assert
+ Assert.IsTrue(handlerExecuted);
+ }
+ }
+
+ [Test]
+ public void CurrentCellChangedHandler_SelectCellInSameRow_SkipEventHandler()
+ {
+ // Setup
+ using (var form = new Form())
+ using (var control = new DataGridViewControl())
+ {
+ form.Controls.Add(control);
+ form.Show();
+
+ var gridTester = new ControlTester("dataGridView");
+
+ control.AddTextBoxColumn("TestRoundedDouble", "Test header");
+ control.AddTextBoxColumn("TestString", "Test string header");
+ control.SetDataSource(new[]
+ {
+ new TestDataGridViewMultipleRows(new RoundedDouble(0, 2.5), "hello world"),
+ new TestDataGridViewMultipleRows(new RoundedDouble(0, 8.3), "test")
+ });
+
+ var handlerExecuted = false;
+ control.AddCurrentRowChangedHandler((sender, args) => handlerExecuted = true);
+
+ // Precondition
+ control.SetCurrentCell(control.GetCell(0, 0));
+ gridTester.FireEvent("CurrentCellChanged", EventArgs.Empty);
+ Assert.IsTrue(handlerExecuted);
+ handlerExecuted = false;
+
+ // Call
+ control.SetCurrentCell(control.GetCell(0, 1));
+ gridTester.FireEvent("CurrentCellChanged", EventArgs.Empty);
+
+ // Assert
+ Assert.IsFalse(handlerExecuted);
+ }
+ }
+
#endregion
}
}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Gui.Test/PropertyBag/DynamicPropertyBagTest.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Core/Common/test/Core.Common.Gui.Test/PropertyBag/DynamicPropertyBagTest.cs (.../DynamicPropertyBagTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Common/test/Core.Common.Gui.Test/PropertyBag/DynamicPropertyBagTest.cs (.../DynamicPropertyBagTest.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -549,14 +549,13 @@
public string Name { get; set; }
[Browsable(true)]
- // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local
- public bool IsNameReadOnly { get; set; }
+ public bool IsNameReadOnly { get; set; } // Property needs to have a setter, otherwise some tests will fail
[Browsable(false)]
public bool Visible { get; set; }
- [ReadOnly(true)] //one static property
- public string Description { get; set; }
+ [ReadOnly(true)]
+ public string Description { get; set; } // Property needs to have a setter, otherwise some tests will fail
///
/// Method checks if propertyName property is read-only (setter can be used).
Index: Core/Components/src/Core.Components.Gis.Forms/Views/WmtsLocationControl.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Core/Components/src/Core.Components.Gis.Forms/Views/WmtsLocationControl.cs (.../WmtsLocationControl.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/src/Core.Components.Gis.Forms/Views/WmtsLocationControl.cs (.../WmtsLocationControl.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -291,7 +291,7 @@
private void InitializeEventHandlers()
{
- dataGridViewControl.AddCurrentCellChangedHandler(DataGridViewCurrentCellChangedHandler);
+ dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewCurrentCellChangedHandler);
}
private void OnUrlLocationSelectedValueChanged(object sender, EventArgs e)
Index: Core/Components/test/Core.Components.Gis.Forms.Test/Views/WellKnownMapDataControlTest.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Core/Components/test/Core.Components.Gis.Forms.Test/Views/WellKnownMapDataControlTest.cs (.../WellKnownMapDataControlTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/test/Core.Components.Gis.Forms.Test/Views/WellKnownMapDataControlTest.cs (.../WellKnownMapDataControlTest.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -140,7 +140,7 @@
{
form.Controls.Add(control);
var dataGridViewControl = (DataGridViewControl) new ControlTester("dataGridViewControl", form).TheObject;
- dataGridViewControl.AddCurrentCellChangedHandler((sender, args) => selectionChanged++);
+ dataGridViewControl.AddCurrentRowChangedHandler((sender, args) => selectionChanged++);
DataGridViewRow row = dataGridViewControl.GetRowFromIndex(2);
dataGridViewControl.SetCurrentCell(row.Cells[0]);
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsControl.cs
===================================================================
diff -u -r3fbb377f0b3df239bfe408f55f45bb67eb5440a2 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsControl.cs (.../IllustrationPointsControl.cs) (revision 3fbb377f0b3df239bfe408f55f45bb67eb5440a2)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsControl.cs (.../IllustrationPointsControl.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -64,6 +64,7 @@
data = value;
illustrationPointsChartControl.Data = data;
illustrationPointsTableControl.Data = data;
+ illustrationPointsTableControl.ResetLastSelectedRow();
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsTableControl.cs
===================================================================
diff -u -rb682197e586584cc5f29fafe31d6ed185b55e1e7 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsTableControl.cs (.../IllustrationPointsTableControl.cs) (revision b682197e586584cc5f29fafe31d6ed185b55e1e7)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsTableControl.cs (.../IllustrationPointsTableControl.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -66,7 +66,7 @@
? CreateRows()
: null);
- UpdateClosingStructureVisibility();
+ UpdateClosingSituationVisibility();
}
}
@@ -80,17 +80,22 @@
}
}
+ public void ResetLastSelectedRow()
+ {
+ illustrationPointsDataGridViewControl.ResetLastSelectedRow();
+ }
+
private void InitializeEventHandlers()
{
- illustrationPointsDataGridViewControl.AddCurrentCellChangedHandler(DataGridViewOnCurrentCellChangedHandler);
+ illustrationPointsDataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChangedHandler);
}
private void DataGridViewOnCurrentCellChangedHandler(object sender, EventArgs e)
{
OnSelectionChanged(e);
}
- private void UpdateClosingStructureVisibility()
+ private void UpdateClosingSituationVisibility()
{
if (data != null)
{
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs
===================================================================
diff -u -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs (.../LocationsView.cs) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs (.../LocationsView.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -174,7 +174,7 @@
private void InitializeEventHandlers()
{
- dataGridViewControl.AddCurrentCellChangedHandler(DataGridViewOnCurrentCellChangedHandler);
+ dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChangedHandler);
dataGridViewControl.AddCellValueChangedHandler(DataGridViewCellValueChanged);
illustrationPointsControl.SelectionChanged += IllustrationPointsControlOnSelectionChanged;
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsControlTest.cs
===================================================================
diff -u -rb682197e586584cc5f29fafe31d6ed185b55e1e7 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsControlTest.cs (.../IllustrationPointsControlTest.cs) (revision b682197e586584cc5f29fafe31d6ed185b55e1e7)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsControlTest.cs (.../IllustrationPointsControlTest.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -87,6 +87,47 @@
}
[Test]
+ public void Data_ValueSet_ResetsLastSelectedRow()
+ {
+ // Setup
+ using (var form = new Form())
+ using (var control = new IllustrationPointsControl())
+ {
+ form.Controls.Add(control);
+ form.Show();
+
+ var data = new[]
+ {
+ new IllustrationPointControlItem(new TestTopLevelIllustrationPoint(),
+ "SSE",
+ "Regular",
+ Enumerable.Empty(),
+ (RoundedDouble) 3.14),
+ new IllustrationPointControlItem(new TestTopLevelIllustrationPoint(),
+ "NE",
+ "Regular",
+ Enumerable.Empty(),
+ (RoundedDouble) 5.2)
+ };
+
+ control.Data = data;
+
+ var selectionChangedCount = 0;
+ control.SelectionChanged += (sender, args) => selectionChangedCount++;
+
+ DataGridViewControl dataGridView = ControlTestHelper.GetDataGridViewControl(form, "illustrationPointsDataGridViewControl");
+ dataGridView.SetCurrentCell(dataGridView.Rows[0].Cells[0]);
+
+ // Call
+ control.Data = data;
+ dataGridView.SetCurrentCell(dataGridView.Rows[0].Cells[2]);
+
+ // Assert
+ Assert.AreEqual(1, selectionChangedCount);
+ }
+ }
+
+ [Test]
public void GivenFullyConfiguredControl_WhenSelectingCellInRow_ThenSelectionChangedFired()
{
// Given
@@ -109,7 +150,8 @@
control.SelectionChanged += (sender, args) => selectionChangedCount++;
IllustrationPointsTableControl tableControl = ControlTestHelper.GetControls(form, "IllustrationPointsTableControl").Single();
-
+ DataGridViewControl dataGridView = ControlTestHelper.GetDataGridViewControl(form, "illustrationPointsDataGridViewControl");
+ dataGridView.SetCurrentCell(dataGridView.Rows[0].Cells[0]);
// When
EventHelper.RaiseEvent(tableControl, "SelectionChanged");
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs
===================================================================
diff -u -rb682197e586584cc5f29fafe31d6ed185b55e1e7 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs (.../IllustrationPointsTableControlTest.cs) (revision b682197e586584cc5f29fafe31d6ed185b55e1e7)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs (.../IllustrationPointsTableControlTest.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -253,6 +253,27 @@
Assert.AreSame(dataBoundItem.IllustrationPointControlItem, selection);
}
+ [Test]
+ public void ResetLastSelectedRow_WhenSelectingSameRow_FiresRowChangedEvent()
+ {
+ // Setup
+ IllustrationPointsTableControl control = ShowControl();
+ control.Data = GetControlItems();
+
+ DataGridView dataGridView = ControlTestHelper.GetDataGridView(testForm, "DataGridView");
+ DataGridViewControl dataGridViewControl = ControlTestHelper.GetDataGridViewControl(testForm, "illustrationPointsDataGridViewControl");
+ dataGridViewControl.SetCurrentCell(dataGridView.Rows[0].Cells[0]);
+ var eventThrown = false;
+ dataGridViewControl.AddCurrentRowChangedHandler((sender, args) => eventThrown = true);
+
+ // Call
+ dataGridViewControl.SetCurrentCell(dataGridView.Rows[0].Cells[1]);
+ control.ResetLastSelectedRow();
+
+ // Assert
+ Assert.IsTrue(eventThrown);
+ }
+
private IllustrationPointsTableControl ShowControl()
{
var control = new IllustrationPointsTableControl();
Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs
===================================================================
diff -u -r67e77262b9f0f183db81f8c95d7b12aa5fcdb8e9 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs (.../DuneLocationsViewBase.cs) (revision 67e77262b9f0f183db81f8c95d7b12aa5fcdb8e9)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs (.../DuneLocationsViewBase.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -173,7 +173,7 @@
private void InitializeEventHandlers()
{
- dataGridViewControl.AddCurrentCellChangedHandler(DataGridViewOnCurrentCellChangedHandler);
+ dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChangedHandler);
dataGridViewControl.AddCellValueChangedHandler(DataGridViewCellValueChanged);
}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs
===================================================================
diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs (.../MacroStabilityInwardsCalculationsView.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs (.../MacroStabilityInwardsCalculationsView.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -196,7 +196,7 @@
private void InitializeDataGridView()
{
- dataGridViewControl.AddCurrentCellChangedHandler(DataGridViewOnCurrentCellChanged);
+ dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChanged);
dataGridViewControl.AddCellFormattingHandler(OnCellFormatting);
dataGridViewControl.AddTextBoxColumn(
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs
===================================================================
diff -u -raa49537188229065df91b1a931f088c32115702a -redb617ef7d51ddd52ed0b0095e679106925a837c
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision aa49537188229065df91b1a931f088c32115702a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c)
@@ -196,7 +196,7 @@
private void InitializeDataGridView()
{
- dataGridViewControl.AddCurrentCellChangedHandler(DataGridViewOnCurrentCellChanged);
+ dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChanged);
dataGridViewControl.AddCellFormattingHandler(OnCellFormatting);
dataGridViewControl.AddTextBoxColumn(