ComponentFactory.Quicksilver.Layout.GridLayout.CalculateDesiredSize C# (CSharp) Method

CalculateDesiredSize() private method

private CalculateDesiredSize ( MetaElementStateDict stateDict, ICollection elements, Size availableSize ) : Size
stateDict MetaElementStateDict
elements ICollection
availableSize System.Windows.Size
return System.Windows.Size
        private Size CalculateDesiredSize(MetaElementStateDict stateDict,
                                          ICollection elements,
                                          Size availableSize)
        {
            double width = _proxyColumns[_proxyColumns.Length - 1].MinTotal + _proxyColumns[_proxyColumns.Length - 1].MinSize;
            double height = _proxyRows[_proxyRows.Length - 1].MinTotal + _proxyRows[_proxyRows.Length - 1].MinSize;

            // If any of the columns is marked as Star
            if (HasColumnStars)
            {
                // If we have infinite space then return the measured width needed for all columns, otherwise we just take all the space
                if (availableSize.Width == double.PositiveInfinity)
                    width = _proxyColumns[_proxyColumns.Length - 1].DesiredTotal + _proxyColumns[_proxyColumns.Length - 1].DesiredSize;
                else
                    width = availableSize.Width;
            }

            // If any of the rows is marked as Star
            if (HasRowStars)
            {
                // If we have infinite space then return the measured height needed for all rows, otherwise we just take all the space
                if (availableSize.Height == double.PositiveInfinity)
                    height = _proxyRows[_proxyRows.Length - 1].DesiredTotal + _proxyRows[_proxyRows.Length - 1].DesiredSize;
                else
                    height = availableSize.Height;
            }

            return new Size(width, height);
        }