コード例 #1
0
        private static LayoutTransformControl CreateWithChildAndMeasureAndTransform(
                                                double width,
                                                double height,
                                                Transform transform)
        {
            var lt = new LayoutTransformControl()
            {
                LayoutTransform = transform,
                Template = new FuncControlTemplate<LayoutTransformControl>(
                                p => new ContentPresenter() { Content = p.Content })
            };

            lt.Content = new Rectangle() { Width = width, Height = height };

            lt.ApplyTemplate();

            //we need to force create visual child
            //so the measure after is correct
            (lt.Presenter as ContentPresenter).UpdateChild();

            Assert.NotNull(lt.Presenter?.Child);

            lt.Measure(Size.Infinity);
            lt.Arrange(new Rect(lt.DesiredSize));

            return lt;
        }
コード例 #2
0
        private static void TransformRootBoundsTest(Size size, Transform transform, Rect expectedBounds)
        {
            LayoutTransformControl lt = CreateWithChildAndMeasureAndTransform(size.Width, size.Height, transform);

            Rect outBounds = lt.TransformRoot.Bounds;

            Assert.Equal(outBounds.X, expectedBounds.X);
            Assert.Equal(outBounds.Y, expectedBounds.Y);
            Assert.Equal(outBounds.Width, expectedBounds.Width);
            Assert.Equal(outBounds.Height, expectedBounds.Height);
        }
コード例 #3
0
 public abstract void PushTransform(Transform transform);
コード例 #4
0
        private static void TransformMeasureSizeTest(Size size, Transform transform, Size expectedSize)
        {
            LayoutTransformControl lt = CreateWithChildAndMeasureAndTransform(
                size.Width,
                size.Height,
                transform);

            Size outSize = lt.DesiredSize;

            Assert.Equal(outSize.Width, expectedSize.Width);
            Assert.Equal(outSize.Height, expectedSize.Height);
        }
コード例 #5
0
 public override void PushTransform(Transform transform)
 {
     Matrix3x2 m = transform.Value.ToSharpDX();
     this.target.Transform = this.target.Transform * m;
     this.stack.Push(m);
 }