Exemple #1
0
        /// <summary>Arranges the content of a <see cref="T:System.Windows.Controls.WrapPanel" /> element.</summary>
        /// <param name="finalSize">The <see cref="T:System.Windows.Size" /> that this element should use to arrange its child elements.</param>
        /// <returns>The <see cref="T:System.Windows.Size" /> that represents the arranged size of this <see cref="T:System.Windows.Controls.WrapPanel" /> element and its children.</returns>
        // Token: 0x06005B53 RID: 23379 RVA: 0x0019BE90 File Offset: 0x0019A090
        protected override Size ArrangeOverride(Size finalSize)
        {
            int    num        = 0;
            double itemWidth  = this.ItemWidth;
            double itemHeight = this.ItemHeight;
            double num2       = 0.0;
            double itemU      = (this.Orientation == Orientation.Horizontal) ? itemWidth : itemHeight;

            WrapPanel.UVSize    uvsize           = new WrapPanel.UVSize(this.Orientation);
            WrapPanel.UVSize    uvsize2          = new WrapPanel.UVSize(this.Orientation, finalSize.Width, finalSize.Height);
            bool                flag             = !DoubleUtil.IsNaN(itemWidth);
            bool                flag2            = !DoubleUtil.IsNaN(itemHeight);
            bool                useItemU         = (this.Orientation == Orientation.Horizontal) ? flag : flag2;
            UIElementCollection internalChildren = base.InternalChildren;
            int i     = 0;
            int count = internalChildren.Count;

            while (i < count)
            {
                UIElement uielement = internalChildren[i];
                if (uielement != null)
                {
                    WrapPanel.UVSize uvsize3 = new WrapPanel.UVSize(this.Orientation, flag ? itemWidth : uielement.DesiredSize.Width, flag2 ? itemHeight : uielement.DesiredSize.Height);
                    if (DoubleUtil.GreaterThan(uvsize.U + uvsize3.U, uvsize2.U))
                    {
                        this.arrangeLine(num2, uvsize.V, num, i, useItemU, itemU);
                        num2  += uvsize.V;
                        uvsize = uvsize3;
                        if (DoubleUtil.GreaterThan(uvsize3.U, uvsize2.U))
                        {
                            this.arrangeLine(num2, uvsize3.V, i, ++i, useItemU, itemU);
                            num2  += uvsize3.V;
                            uvsize = new WrapPanel.UVSize(this.Orientation);
                        }
                        num = i;
                    }
                    else
                    {
                        uvsize.U += uvsize3.U;
                        uvsize.V  = Math.Max(uvsize3.V, uvsize.V);
                    }
                }
                i++;
            }
            if (num < internalChildren.Count)
            {
                this.arrangeLine(num2, uvsize.V, num, internalChildren.Count, useItemU, itemU);
            }
            return(finalSize);
        }
Exemple #2
0
        /// <summary>Measures the child elements of a <see cref="T:System.Windows.Controls.WrapPanel" /> in anticipation of arranging them during the <see cref="M:System.Windows.Controls.WrapPanel.ArrangeOverride(System.Windows.Size)" /> pass.</summary>
        /// <param name="constraint">An upper limit <see cref="T:System.Windows.Size" /> that should not be exceeded.</param>
        /// <returns>The <see cref="T:System.Windows.Size" /> that represents the desired size of the element.</returns>
        // Token: 0x06005B52 RID: 23378 RVA: 0x0019BC88 File Offset: 0x00199E88
        protected override Size MeasureOverride(Size constraint)
        {
            WrapPanel.UVSize    uvsize           = new WrapPanel.UVSize(this.Orientation);
            WrapPanel.UVSize    uvsize2          = new WrapPanel.UVSize(this.Orientation);
            WrapPanel.UVSize    uvsize3          = new WrapPanel.UVSize(this.Orientation, constraint.Width, constraint.Height);
            double              itemWidth        = this.ItemWidth;
            double              itemHeight       = this.ItemHeight;
            bool                flag             = !DoubleUtil.IsNaN(itemWidth);
            bool                flag2            = !DoubleUtil.IsNaN(itemHeight);
            Size                availableSize    = new Size(flag ? itemWidth : constraint.Width, flag2 ? itemHeight : constraint.Height);
            UIElementCollection internalChildren = base.InternalChildren;
            int i     = 0;
            int count = internalChildren.Count;

            while (i < count)
            {
                UIElement uielement = internalChildren[i];
                if (uielement != null)
                {
                    uielement.Measure(availableSize);
                    WrapPanel.UVSize uvsize4 = new WrapPanel.UVSize(this.Orientation, flag ? itemWidth : uielement.DesiredSize.Width, flag2 ? itemHeight : uielement.DesiredSize.Height);
                    if (DoubleUtil.GreaterThan(uvsize.U + uvsize4.U, uvsize3.U))
                    {
                        uvsize2.U  = Math.Max(uvsize.U, uvsize2.U);
                        uvsize2.V += uvsize.V;
                        uvsize     = uvsize4;
                        if (DoubleUtil.GreaterThan(uvsize4.U, uvsize3.U))
                        {
                            uvsize2.U  = Math.Max(uvsize4.U, uvsize2.U);
                            uvsize2.V += uvsize4.V;
                            uvsize     = new WrapPanel.UVSize(this.Orientation);
                        }
                    }
                    else
                    {
                        uvsize.U += uvsize4.U;
                        uvsize.V  = Math.Max(uvsize4.V, uvsize.V);
                    }
                }
                i++;
            }
            uvsize2.U  = Math.Max(uvsize.U, uvsize2.U);
            uvsize2.V += uvsize.V;
            return(new Size(uvsize2.Width, uvsize2.Height));
        }
Exemple #3
0
        // Token: 0x06005B54 RID: 23380 RVA: 0x0019C068 File Offset: 0x0019A268
        private void arrangeLine(double v, double lineV, int start, int end, bool useItemU, double itemU)
        {
            double num  = 0.0;
            bool   flag = this.Orientation == Orientation.Horizontal;
            UIElementCollection internalChildren = base.InternalChildren;

            for (int i = start; i < end; i++)
            {
                UIElement uielement = internalChildren[i];
                if (uielement != null)
                {
                    WrapPanel.UVSize uvsize = new WrapPanel.UVSize(this.Orientation, uielement.DesiredSize.Width, uielement.DesiredSize.Height);
                    double           num2   = useItemU ? itemU : uvsize.U;
                    uielement.Arrange(new Rect(flag ? num : v, flag ? v : num, flag ? num2 : lineV, flag ? lineV : num2));
                    num += num2;
                }
            }
        }