示例#1
0
        public void GetCorrectClippingElement()
        {
            var doc = XDocument.Load(@"TestFiles\xamlUntidy.xaml");

            ConverterLogic.RemoveResDictEntries(doc.Root);
            var drawingGroupElements = doc.Root.XPathSelectElements("defns:DrawingGroup", ConverterLogic.NsManager).ToList();

            var clipElements = drawingGroupElements.Select(dg =>
            {
                Rect rect;
                var element = ConverterLogic.GetClipElement(dg, out rect);
                return(Tuple.Create(element, rect));
            }).ToArray();

            foreach (var clipElement in clipElements)
            {
                Console.WriteLine(clipElement.Item2);
                Console.WriteLine(clipElement.Item1);
                Console.WriteLine();
            }

            clipElements[0].Item2.Should().Be(new Rect(0, 0, 40, 40));
            clipElements[1].Item2.Should().Be(new Rect(0, 0, 45, 34));
            //..
        }