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

MeasureChildren() public method

Measure the layout size required to arrange all elements.
public MeasureChildren ( string layoutId, MetaPanelBase metaPanel, MetaElementStateDict stateDict, ICollection elements, Size availableSize ) : Size
layoutId string Identifier of the layout to be used.
metaPanel MetaPanelBase Reference to owning panel instance.
stateDict MetaElementStateDict Dictionary of per-element state.
elements ICollection Collection of elements to be measured.
availableSize System.Windows.Size Available size that can be given to elements.
return System.Windows.Size
        public override Size MeasureChildren(string layoutId,
                                             MetaPanelBase metaPanel,
                                             MetaElementStateDict stateDict,
                                             ICollection elements,
                                             Size availableSize)
        {
            Size retSize = new Size();

            // Only apply if we match the incoming layout identifier
            if (string.IsNullOrEmpty(Id) || Id.Equals(layoutId))
            {
                // If there are no column/row definitions then size to available area
                if ((_columns.Count == 0) && (_rows.Count == 0))
                {
                    foreach (UIElement element in elements)
                    {
                        stateDict[element].Element.Measure(availableSize);
                        retSize.Width = Math.Max(retSize.Width, stateDict[element].Element.DesiredSize.Width);
                        retSize.Height = Math.Max(retSize.Height, stateDict[element].Element.DesiredSize.Height);
                    }
                }
                else
                {
                    BuildProxyColumns();
                    BuildProxyRows();
                    PreMeasure(availableSize);
                    MeasureElements(stateDict, elements);
                    UpdateDefinitions(stateDict, elements, false);
                    UpdateDefinitions(stateDict, elements, true);
                    CalculateOffsetsAndTotals();
                    retSize = CalculateDesiredSize(stateDict, elements, availableSize);
                }
            }

            return retSize;
        }