protected override Size ArrangeOverride(Size finalSize) { AdornerLayer.Arrange(new Rect(finalSize)); if (TemplateChild != null) { if (delegateScrollInfo == innerScrollInfo) { Size finalScrollSize = new Size(CanHorizontallyScroll ? Double.PositiveInfinity : finalSize.Width, CanVerticallyScroll ? Double.PositiveInfinity : finalSize.Height); Size childFinalSize = TemplateChild.DesiredSize.Bounds(finalSize, finalScrollSize); Point childOffset = Offset.Bounds(Point.Zero, (childFinalSize - ViewportSize).Max(Size.Zero).ToPoint()); TemplateChild.Arrange(new Rect(-childOffset, childFinalSize)); } else { // CanContentScroll and Content implements IScrollInfo TemplateChild.Arrange(new Rect(finalSize)); } } innerScrollInfo.ExtentSize = TemplateChild != null ? TemplateChild.VisualSize : Size.Zero; innerScrollInfo.ViewportSize = finalSize; return(finalSize); }
protected override Size ArrangeOverride(Size finalSize) { if (TemplateChild != null) { TemplateChild.Arrange(new Rect(finalSize)); } return(finalSize); }