ArrangeCalculate() public method

Calculates the position of each item within the Panel's Children collection.
This method is used by the 'Arrange' method. Call the 'Measure' method before invoking 'ArrangeCalculate'.
public ArrangeCalculate ( Size finalSize, List &returnBounds ) : Size
finalSize System.Windows.Size The final area within the parent that this object should use to arrange itself and its children.
returnBounds List Returns a list of element bounds corresponding, in order, to each child within the Panel.
return System.Windows.Size
        public void ShouldArrangeVertically()
        {
            var canvas = GetCanvas();
            var arranger = new StackArranger(canvas.Children, Orientation.Vertical);

            var size = new Size(200, 800);
            List<ElementBounds> layout;
            arranger.Measure(size);
            arranger.ArrangeCalculate(size, out layout);

            layout[0].Bounds.Top.ShouldBe(0.0);
            layout[1].Bounds.Top.ShouldBe(100.0);
            layout[2].Bounds.Top.ShouldBe(200.0);

            foreach (FrameworkElement child in canvas.Children)
            {
                child.Margin = new Thickness(5);
            }

            arranger.Measure(size);
            arranger.ArrangeCalculate(size, out layout);

            layout[0].Bounds.Top.ShouldBe(0.0);
            layout[1].Bounds.Top.ShouldBe(110.0);
            layout[2].Bounds.Top.ShouldBe(220.0);
        }
        public void ShouldStretchToFit()
        {
            var canvas = GetCanvas();
            var arranger = new StackArranger(canvas.Children, Orientation.Vertical);

            var size = new Size(200, 800);
            List<ElementBounds> layout;
            arranger.Measure(size);
            arranger.ArrangeCalculate(size, out layout);

            // Not stretching.
            layout[0].Bounds.Width.ShouldBe(100.0);
            layout[1].Bounds.Width.ShouldBe(100.0);
            layout[2].Bounds.Width.ShouldBe(100.0);

            foreach (FrameworkElement child in canvas.Children)
            {
                child.Width = double.NaN;
            }

            arranger.Measure(size);
            arranger.ArrangeCalculate(size, out layout);

            layout[0].Bounds.Width.ShouldBe(200.0);
            layout[1].Bounds.Width.ShouldBe(200.0);
            layout[2].Bounds.Width.ShouldBe(200.0);

            // Horizontal
            arranger.Orientation = Orientation.Horizontal;
            size = new Size(800, 200);
            arranger.Measure(size);
            arranger.ArrangeCalculate(size, out layout);

            layout[0].Bounds.Height.ShouldBe(100.0);
            layout[1].Bounds.Height.ShouldBe(100.0);
            layout[2].Bounds.Height.ShouldBe(100.0);

            foreach (FrameworkElement child in canvas.Children)
            {
                child.Height = double.NaN;
            }

            arranger.Measure(size);
            arranger.ArrangeCalculate(size, out layout);

            layout[0].Bounds.Height.ShouldBe(200.0);
            layout[1].Bounds.Height.ShouldBe(200.0);
            layout[2].Bounds.Height.ShouldBe(200.0);
        }