ComponentFactory.Quicksilver.Layout.RadialLayout.MeasureChildren C# (CSharp) Méthode

MeasureChildren() public méthode

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.
Résultat System.Windows.Size
        public override Size MeasureChildren(string layoutId,
                                             MetaPanelBase metaPanel,
                                             MetaElementStateDict stateDict,
                                             ICollection elements,
                                             Size availableSize)
        {
            // Measure each element in turn
            _count = 0;
            Size maxSize = new Size();
            foreach (UIElement element in elements)
                if (element != null)
                {
                    element.Measure(Utility.SizeInfinity);

                    // We ignore items being removed
                    if (stateDict[element].Status != MetaElementStatus.Removing)
                    {
                        // We ignore items that are collapsed
                        if (element.Visibility != Visibility.Collapsed)
                        {
                            // Find the widest and tallest element
                            maxSize.Width = Math.Max(maxSize.Width, element.DesiredSize.Width);
                            maxSize.Height = Math.Max(maxSize.Height, element.DesiredSize.Height);

                            // Count number of valid elements
                            _count++;
                        }
                    }
                }

            // Max length is the diagonal length of biggest element
            _maxLength = Math.Sqrt((maxSize.Width * maxSize.Width) + (maxSize.Height * maxSize.Height));

            // Always use the provided size
            return availableSize;
        }