diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs index 7744bc93c0..6b509d98af 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs @@ -358,8 +358,6 @@ namespace ICSharpCode.WpfDesign.Tests.Designer Assert.IsTrue(((System.Windows.Input.InputBindingCollection)inputbinding.ValueOnInstance).Count == inputbinding.CollectionElements.Count); const string undoXaml = @" - - "; s.Undo(); diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionElementsCollection.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionElementsCollection.cs index 6566897e28..ac3bb33b3b 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionElementsCollection.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionElementsCollection.cs @@ -61,6 +61,11 @@ namespace ICSharpCode.WpfDesign.XamlDom this[index].RemoveNodeFromParent(); this[index].ParentProperty = null; base.RemoveItem(index); + + // If item was removed from an implicit collection that is now empty we reset its property to remove markup for the property if still there. + if (Count == 0 && property.PropertyValue == null) { + property.Reset(); + } } protected override void InsertItem(int index, XamlPropertyValue item)