private LayoutViewResult LayoutView(PointF layoutOrigin, ref LayoutParams layoutParams)
        {
            var freeSpaceSize = new SizeF(Math.Max(0, _layoutSpaceBounds.Right - layoutOrigin.X),
                                          Math.Max(0, _layoutSpaceBounds.Bottom - layoutOrigin.Y));
            //Free space available a view in layout coordinates
            var freeSpace = new RectangleF(layoutOrigin, freeSpaceSize);
            //Free space available for a view in view coordinates
            var viewFreeSpace = _layoutToView.Transform(freeSpace);
            //Area which view wants to occupy in view coordinates
            var viewBox = _layoutBuilder.View(layoutParams.View, viewFreeSpace);

            _views.Add(viewBox);
            layoutParams.Layout(viewBox);
            //Area which view wants to occupy in layout coordinates
            var layoutFrame = _viewToLayout.Transform(viewBox.Frame());
            //Space required for view starting from layout origin in layout coordinates
            var viewFrame       = new RectangleF(layoutOrigin, new SizeF(layoutFrame.Right - layoutOrigin.X, layoutFrame.Bottom - layoutOrigin.Y));
            var newLayoutOrigin = new PointF(viewFrame.Right + LayoutStep, viewFrame.Top);

            return(new LayoutViewResult()
            {
                ViewLayoutBox = viewBox,
                NewLayoutOrigin = newLayoutOrigin,
                LayoutViewFrame = viewFrame
            });
        }
        private LayoutViewResult LayoutView(PointF layoutOrigin, ref LayoutParams layoutParams)
        {
            var freeSpaceSize = new SizeF(_layoutBounds.Right - layoutOrigin.X, _layoutBounds.Bottom - layoutOrigin.Y);
            //Free space available a view in layout coordinates
            var freeSpace = new RectangleF(layoutOrigin, freeSpaceSize);
            //Free space available for a view in view coordinates
            var viewFreeSpace = _layoutToView.Transform(freeSpace);
            //Postion which view wants to occupy in view coordinates
            var viewBox = layoutParams.LayoutView(viewFreeSpace);
            //Postion which view wants to occupy in layout coordinates
            var layoutFrame = _viewToLayout.Transform(viewBox.LayoutBounds);
            //Space required for view starting from layout origin in layout coordinates
            var viewFrame       = new RectangleF(layoutOrigin, new SizeF(layoutFrame.Right - layoutOrigin.X, layoutFrame.Bottom - layoutOrigin.Y));
            var newLayoutOrigin = new PointF(viewFrame.Right, viewFrame.Top);

            return(new LayoutViewResult()
            {
                ViewLayoutBox = viewBox,
                NewLayoutOrigin = newLayoutOrigin,
                LayoutViewFrame = viewFrame
            });
        }