Ejemplo n.º 1
0
        private void MeasureGroupElement(BaseListViewGroupVisualItem groupElement)
        {
            ListViewDataItemGroup data = groupElement.Data as ListViewDataItemGroup;

            if (groupElement.HasVisibleItems())
            {
                int   itemSpacing = this.owner.ItemSpacing;
                float num1        = 0.0f;
                float width       = 0.0f;
                float val1        = 0.0f;
                int   num2        = 1;
                foreach (ListViewDataItem listViewDataItem in data.Items)
                {
                    float num3 = num1 + (float)listViewDataItem.ActualSize.Height;
                    if (num2 > 1)
                    {
                        num3 += (float)itemSpacing;
                    }
                    if ((double)num3 > (double)this.clientRect.Height)
                    {
                        num1   = 0.0f;
                        num2   = 1;
                        width += val1;
                        if (this.owner.Orientation == Orientation.Horizontal)
                        {
                            width += (float)itemSpacing;
                        }
                        val1 = 0.0f;
                    }
                    num1 += (float)listViewDataItem.ActualSize.Height;
                    if (num2 > 1)
                    {
                        num1 += (float)itemSpacing;
                    }
                    val1 = Math.Max(val1, (float)listViewDataItem.ActualSize.Width);
                    ++num2;
                }
                if ((double)val1 > 0.0)
                {
                    width += val1;
                }
                int num4 = !this.owner.Owner.AllowArbitraryItemHeight || data.Size.Height <= 0 ? this.owner.GroupItemSize.Height : data.Size.Height;
                groupElement.Measure(new SizeF(width, (float)num4));
            }
            else
            {
                groupElement.Measure(this.clientRect.Size);
                this.currentX += groupElement.DesiredSize.Width;
                this.currentY  = this.clientRect.Top;
            }
        }