Esempio n. 1
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            float finalHeight = 0;

            RadPanelBarElement panelBar = (RadPanelBarElement)this.Parent;

            float y = 0;
            float x = 1;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];

                PointF groupLocation = new PointF(x, y);

                SizeF groupSize = new SizeF(
                    availableSize.Width - 2,
                    availableSize.Height);

                RectangleF groupBounds = new RectangleF(groupLocation, groupSize);

                group.Measure(groupBounds.Size);

                finalHeight += y;
            }

            this.OnMeasureModified(EventArgs.Empty);

            return(availableSize);
        }
Esempio n. 2
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            float finalHeight = 0;

            RadPanelBarElement panelBar = (RadPanelBarElement)this.Parent;

            if (panelBar == null)
            {
                return(base.MeasureOverride(availableSize));
            }

            base.MeasureOverride(availableSize);

            float y       = panelBar.TopOffset;
            float x       = 1 + panelBar.LeftOffset;
            int   counter = 0;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];

                PointF groupLocation = new PointF(x, y);


                SizeF groupSize = new SizeF(
                    (availableSize.Width - 2 - panelBar.LeftOffset - panelBar.RightOffset - ((panelBar.NumberOfColumns - 1) * panelBar.SpacingBetweenColumns)) / panelBar.NumberOfColumns,
                    availableSize.Height);


                //	group.Measure(availableSize);

                if (counter >= panelBar.NumberOfColumns)
                {
                    x       = 1 + panelBar.LeftOffset;
                    counter = 0;

                    float maxHeight = 0;
                    for (int j = i - panelBar.NumberOfColumns; j < i; j++)
                    {
                        RadPanelBarGroupElement searchingGroup = (RadPanelBarGroupElement)this.Children[j];

                        maxHeight = Math.Max(maxHeight, searchingGroup.DesiredSize.Height);
                    }


                    y            += maxHeight + panelBar.SpacingBetweenGroups;
                    groupLocation = new PointF(x, y);
                }
                else
                {
                    x += groupSize.Width + panelBar.SpacingBetweenColumns;
                }

                int captionSize = (int)group.GetCaptionElement().DesiredSize.Height;

                RectangleF groupBounds = new RectangleF(groupLocation, groupSize);
                group.Measure(groupBounds.Size);

                if (group.ContentPanel.Height + captionSize > groupBounds.Height)
                {
                    double calculatedHeight = captionSize + group.ContentPanel.Height;

                    groupBounds = new RectangleF(groupLocation, new SizeF(groupSize.Width, (float)calculatedHeight));
                    group.Measure(groupBounds.Size);
                }


                finalHeight += group.DesiredSize.Height;
                counter++;
            }

            this.OnMeasureModified(EventArgs.Empty);


            return(new SizeF(availableSize.Width, finalHeight));
        }