diff --git a/WpfDesign.Designer/Tests/Designer/TransformTests.cs b/WpfDesign.Designer/Tests/Designer/TransformTests.cs new file mode 100644 index 0000000..48f562f --- /dev/null +++ b/WpfDesign.Designer/Tests/Designer/TransformTests.cs @@ -0,0 +1,28 @@ +using System.Windows; +using System.Windows.Media; +using ICSharpCode.WpfDesign.Designer; +using NUnit.Framework; + +namespace ICSharpCode.WpfDesign.Tests.Designer +{ + public class TransformTests : ModelTestHelper + { + internal static void Rotate(double angle, DesignItem item) + { + ModelTools.ApplyTransform(item, new RotateTransform(angle, 0.5, 0.5)); + } + + [Test] + public void RotateSkewedButton() + { + DesignItem button = CreateCanvasContext( + ""); + Rotate(30, button); + //AssertCanvasDesignerOutput(); + } + } +} \ No newline at end of file diff --git a/WpfDesign.XamlDom/Project/XamlProperty.cs b/WpfDesign.XamlDom/Project/XamlProperty.cs index 5f228de..d31f3aa 100644 --- a/WpfDesign.XamlDom/Project/XamlProperty.cs +++ b/WpfDesign.XamlDom/Project/XamlProperty.cs @@ -505,12 +505,10 @@ internal void InsertNodeInCollection(XmlNode newChildNode, int index) collection = parentObject.XmlElement; } } - if (collectionElements.Count == 0) { - // collection is empty -> we may insert anywhere + if (collectionElements.Count == 0 || index == collectionElements.Count) { + // collection is empty -> we may insert anywhere, thus we choose the end + // or the index is the end of the list: collection.AppendChild(newChildNode); - } else if (index == collectionElements.Count) { - // insert after last element in collection - collection.InsertAfter(newChildNode, collectionElements[collectionElements.Count - 1].GetNodeForCollection()); } else { // insert before specified index collection.InsertBefore(newChildNode, collectionElements[index].GetNodeForCollection());