Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/FeatureBasedMapDataProperties.cs =================================================================== diff -u -r44a6e3afcdfce467ecc9d51d77b5bf4c3a5590eb -r72c17e3476c4e8dc4fa1e61ce324093da2ec57ff --- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/FeatureBasedMapDataProperties.cs (.../FeatureBasedMapDataProperties.cs) (revision 44a6e3afcdfce467ecc9d51d77b5bf4c3a5590eb) +++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/FeatureBasedMapDataProperties.cs (.../FeatureBasedMapDataProperties.cs) (revision 72c17e3476c4e8dc4fa1e61ce324093da2ec57ff) @@ -28,6 +28,7 @@ using Core.Common.Gui.Converters; using Core.Common.Gui.PropertyBag; using Core.Common.Util.Attributes; +using Core.Common.Util.Extensions; using Core.Components.Gis.Data; using Core.Plugins.Map.Properties; using Core.Plugins.Map.UITypeEditors; @@ -106,6 +107,8 @@ { data.IsVisible = value; data.NotifyObservers(); + + parents.ForEachElementDo(collection => collection.NotifyObservers()); } } Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/FeatureBasedMapDataPropertiesTest.cs =================================================================== diff -u -r44a6e3afcdfce467ecc9d51d77b5bf4c3a5590eb -r72c17e3476c4e8dc4fa1e61ce324093da2ec57ff --- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/FeatureBasedMapDataPropertiesTest.cs (.../FeatureBasedMapDataPropertiesTest.cs) (revision 44a6e3afcdfce467ecc9d51d77b5bf4c3a5590eb) +++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/FeatureBasedMapDataPropertiesTest.cs (.../FeatureBasedMapDataPropertiesTest.cs) (revision 72c17e3476c4e8dc4fa1e61ce324093da2ec57ff) @@ -27,6 +27,7 @@ using Core.Common.Gui.Converters; using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; +using Core.Common.Util.Extensions; using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; @@ -220,7 +221,7 @@ public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() { // Setup - const int numberOfChangedProperties = 3; + const int numberOfChangedProperties = 2; var mocks = new MockRepository(); var observer = mocks.StrictMock(); observer.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); @@ -236,18 +237,46 @@ var properties = new TestFeatureBasedMapDataProperties(mapData, Enumerable.Empty()); // Call - properties.IsVisible = false; properties.ShowLabels = false; properties.SelectedMetaDataAttribute = new SelectableMetaDataAttribute("ID"); // Assert - Assert.IsFalse(mapData.IsVisible); Assert.IsFalse(mapData.ShowLabels); Assert.AreEqual("ID", mapData.SelectedMetaDataAttribute); mocks.VerifyAll(); } [Test] + public void IsVisible_SetNewValue_UpdateDataAndNotifyObserversOfDataAndParents() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()).Repeat.Times(4); + mocks.ReplayAll(); + + var mapData = new TestFeatureBasedMapData(); + var parents = new[] + { + new MapDataCollection("test 1"), + new MapDataCollection("test 2"), + new MapDataCollection("test 3"), + }; + + mapData.Attach(observer); + parents.ForEachElementDo(parent => parent.Attach(observer)); + + var properties = new TestFeatureBasedMapDataProperties(mapData, parents); + + // Call + properties.IsVisible = false; + + // Assert + Assert.IsFalse(properties.IsVisible); + mocks.VerifyAll(); + } + + [Test] [TestCase(true)] [TestCase(false)] public void ShowLabels_MapDataHasMetaData_ShowLabelsAndSelectedMetaDataAttributeShouldNotBeReadOnly(bool hasMetaData)