Beispiel #1
0
        /// <summary>
        /// ToolBarTray arranges its ToolBar children.
        /// </summary>
        /// <param name="arrangeSize">Size that ToolBarTray will assume to position children.</param>
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            int  bandIndex;
            int  toolBarIndex;
            bool fHorizontal = (Orientation == Orientation.Horizontal);
            Rect rcChild     = new Rect();

            for (bandIndex = 0; bandIndex < _bands.Count; bandIndex++)
            {
                List <ToolBar> band = _bands[bandIndex].Band;

                double bandThickness = _bands[bandIndex].Thickness;

                if (fHorizontal)
                {
                    rcChild.X = 0;
                }
                else
                {
                    rcChild.Y = 0;
                }

                for (toolBarIndex = 0; toolBarIndex < band.Count; toolBarIndex++)
                {
                    ToolBar toolBar            = band[toolBarIndex];
                    Size    toolBarArrangeSize = new Size(fHorizontal ? toolBar.DesiredSize.Width : bandThickness, fHorizontal ? bandThickness : toolBar.DesiredSize.Height);
                    rcChild.Size = toolBarArrangeSize;
                    toolBar.Arrange(rcChild);
                    if (fHorizontal)
                    {
                        rcChild.X += toolBarArrangeSize.Width;
                    }
                    else
                    {
                        rcChild.Y += toolBarArrangeSize.Height;
                    }
                }

                if (fHorizontal)
                {
                    rcChild.Y += bandThickness;
                }
                else
                {
                    rcChild.X += bandThickness;
                }
            }

            return(arrangeSize);
        }
Beispiel #2
0
        /// <summary> Called to arrange and size its <see cref="T:System.Windows.Controls.ToolBar" /> children. </summary>
        /// <param name="arrangeSize">The size that the <see cref="T:System.Windows.Controls.ToolBarTray" /> assumes to position its children.</param>
        /// <returns>The size of the control.</returns>
        // Token: 0x06005855 RID: 22613 RVA: 0x00187378 File Offset: 0x00185578
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            bool flag      = this.Orientation == Orientation.Horizontal;
            Rect finalRect = default(Rect);

            for (int i = 0; i < this._bands.Count; i++)
            {
                List <ToolBar> band      = this._bands[i].Band;
                double         thickness = this._bands[i].Thickness;
                if (flag)
                {
                    finalRect.X = 0.0;
                }
                else
                {
                    finalRect.Y = 0.0;
                }
                for (int j = 0; j < band.Count; j++)
                {
                    ToolBar toolBar = band[j];
                    Size    size    = new Size(flag ? toolBar.DesiredSize.Width : thickness, flag ? thickness : toolBar.DesiredSize.Height);
                    finalRect.Size = size;
                    toolBar.Arrange(finalRect);
                    if (flag)
                    {
                        finalRect.X += size.Width;
                    }
                    else
                    {
                        finalRect.Y += size.Height;
                    }
                }
                if (flag)
                {
                    finalRect.Y += thickness;
                }
                else
                {
                    finalRect.X += thickness;
                }
            }
            return(arrangeSize);
        }