Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs =================================================================== diff -u -rd506ab6eea64d53852f6419f39493e3a326078b0 -r2a9a0a500bc605a383e700b6d8f4b407abd42486 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs (.../BackgroundMapDataSelectionDialog.cs) (revision d506ab6eea64d53852f6419f39493e3a326078b0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs (.../BackgroundMapDataSelectionDialog.cs) (revision 2a9a0a500bc605a383e700b6d8f4b407abd42486) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; using Core.Common.Controls.DataGrid; using Core.Common.Controls.Dialogs; @@ -55,7 +56,7 @@ InitializeComponent(); InitializeComboBox(); - selectButton.Enabled = false; + UpdateSelectButton(); } /// @@ -83,17 +84,34 @@ return cancelButton; } + private void UpdateSelectButton() + { + selectButton.Enabled = SelectedMapData != null; + } + private void UpdatePropertiesGroupBox() { if (currentMapDataControl != null) { + var currentHasMapData = propertiesGroupBox.Controls.OfType().FirstOrDefault() as IHasMapData; + if (currentHasMapData != null) + { + currentHasMapData.SelectedMapDataChanged -= OnSelectedMapDataChanged; + } + propertiesGroupBox.Controls.Clear(); Control userControl = currentMapDataControl.UserControl; propertiesGroupBox.Controls.Add(userControl); userControl.Dock = DockStyle.Fill; + currentMapDataControl.SelectedMapDataChanged += OnSelectedMapDataChanged; } } + private void OnSelectedMapDataChanged(object sender, EventArgs e) + { + UpdateSelectButton(); + } + #region ComboBox private void InitializeComboBox()