Example #1
0
        protected override void OnArrange()
        {
            if (Inner == null)
            {
                return;
            }

            var clipShift = new Point(-ClipMargin.Left.AbsoluteOrDefault(), -ClipMargin.Top.AbsoluteOrDefault());
            var clipSize  = Inner.DesiredSize.Subtract(ClipMargin.GetAbsoluteSize());
            var shift     = CalculateAlignmentShift(clipSize);
            var location  = Point.Empty;

            location.Offset(clipShift);
            location.Offset(shift);
            location.Offset(Layout.Location);
            Inner.Arrange(new Rectangle(location, Inner.DesiredSize));

            var viewRegionSize = Inner.DesiredSize.Subtract(new Size(
                                                                ClipMargin.Right.AbsoluteOrDefault(),
                                                                ClipMargin.Bottom.AbsoluteOrDefault()))
                                 .Subtract(new Size(Math.Max(0, shift.X), Math.Max(0, shift.Y)));


            var clipped = new Rectangle(location, viewRegionSize);

            clipped.Intersect(Layout);
            ActualViewRegion = clipped;
        }
Example #2
0
        protected override Size OnMeasure(Size size, IRendererContext context)
        {
            if (Inner == null)
            {
                return(Size.Empty);
            }

            var marginSize = ClipMargin.GetAbsoluteSize();

            Inner.Measure(size.Add(marginSize), context);
            return(Inner.DesiredSize.Subtract(marginSize));
        }