Browse Source

Removes markup for empty implicit collections.

pull/657/head
gumme 11 years ago
parent
commit
1cc5346e7a
  1. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs
  2. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionElementsCollection.cs

2
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); Assert.IsTrue(((System.Windows.Input.InputBindingCollection)inputbinding.ValueOnInstance).Count == inputbinding.CollectionElements.Count);
const string undoXaml = @"<TextBlock> const string undoXaml = @"<TextBlock>
<TextBlock.InputBindings>
</TextBlock.InputBindings>
</TextBlock>"; </TextBlock>";
s.Undo(); s.Undo();

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionElementsCollection.cs

@ -61,6 +61,11 @@ namespace ICSharpCode.WpfDesign.XamlDom
this[index].RemoveNodeFromParent(); this[index].RemoveNodeFromParent();
this[index].ParentProperty = null; this[index].ParentProperty = null;
base.RemoveItem(index); 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) protected override void InsertItem(int index, XamlPropertyValue item)

Loading…
Cancel
Save