private void OnMenuItem_DropDownOpening(object sender, CancelEventArgs e)
        {
            if (this.IsDesignMode)
            {
                return;
            }
            RadMenuItemBase radMenuItemBase = sender as RadMenuItemBase;

            if (radMenuItemBase == null)
            {
                return;
            }
            RadPopupOpeningEventArgs openingEventArgs = e as RadPopupOpeningEventArgs;

            if (!(radMenuItemBase.Parent is RadDropDownMenuLayout))
            {
                return;
            }
            RadDropDownMenuLayout parent = radMenuItemBase.Parent as RadDropDownMenuLayout;

            openingEventArgs.CustomLocation = new Point(openingEventArgs.CustomLocation.X, parent.ControlBoundingRectangle.Y + this.DropDownMenu.Location.Y);
            RadDropDownMenu dropDown = radMenuItemBase.DropDown;
            Size            size     = new Size(dropDown.Width, parent.ControlBoundingRectangle.Height);

            dropDown.MinimumSize = size;
        }
Beispiel #2
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF empty = SizeF.Empty;
            float num1  = 0.0f;
            float num2  = 0.0f;
            RadDropDownMenuLayout parent = this.Parent as RadDropDownMenuLayout;

            if (parent != null)
            {
                num1 = parent.LeftColumnMaxPadding + parent.LeftColumnWidth;
                num2 = parent.LeftColumnMaxPadding + parent.RightColumnWidth;
            }
            for (int index = 0; index < this.Children.Count; ++index)
            {
                RadElement child = this.Children[index];
                child.Measure(availableSize);
                empty.Height = Math.Max(child.DesiredSize.Height, empty.Height);
                if (object.ReferenceEquals((object)child, (object)this.comboBoxElement))
                {
                    empty.Width += child.DesiredSize.Width;
                }
            }
            empty.Width  += num1 + num2;
            empty.Width  += (float)(this.Padding.Horizontal + this.BorderThickness.Horizontal);
            empty.Height += (float)(this.Padding.Vertical + this.BorderThickness.Vertical);
            return(empty);
        }
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRectangle = this.GetClientRectangle(finalSize);
            RadDropDownMenuLayout ancestor        = this.FindAncestor <RadDropDownMenuLayout>();

            if (ancestor != null)
            {
                clientRectangle.X     += this.RightToLeft ? 0.0f : ancestor.LeftColumnWidth;
                clientRectangle.Width -= ancestor.LeftColumnWidth;
            }
            foreach (RadElement child in this.Children)
            {
                if (child == this.checkBoxElement)
                {
                    child.Arrange(new RectangleF(clientRectangle.X, 0.0f, clientRectangle.Width, this.checkBoxElement.DesiredSize.Height));
                }
                else if (child == this.calendarElement)
                {
                    this.calendarElement.Calendar.Size = new Size((int)clientRectangle.Width, (int)((double)clientRectangle.Height - (double)this.checkBoxElement.DesiredSize.Height));
                    this.calendarElement.Arrange(new RectangleF(clientRectangle.X, this.checkBoxElement.DesiredSize.Height, clientRectangle.Width, clientRectangle.Height - this.checkBoxElement.DesiredSize.Height));
                }
                else
                {
                    child.Arrange(clientRectangle);
                }
            }
            return(finalSize);
        }
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF res         = SizeF.Empty;
            float leftColumn  = 0;
            float rightColumn = 0;
            RadDropDownMenuLayout menuLayout = this.Parent as RadDropDownMenuLayout;

            if (menuLayout != null)
            {
                leftColumn  = menuLayout.LeftColumnMaxPadding + menuLayout.LeftColumnWidth;
                rightColumn = menuLayout.LeftColumnMaxPadding + menuLayout.RightColumnWidth;
            }
            for (int i = 0; i < this.Children.Count; i++)
            {
                RadElement child = this.Children[i];
                child.Measure(availableSize);
                res.Height = Math.Max(child.DesiredSize.Height, res.Height);
                if (object.ReferenceEquals(child, this.menuElement))
                {
                    res.Width += child.DesiredSize.Width;
                }
            }
            res.Width  += leftColumn + rightColumn;
            res.Width  += this.Padding.Horizontal + this.BorderThickness.Horizontal;
            res.Height += this.Padding.Vertical + this.BorderThickness.Vertical;
            return(res);
        }
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRect = GetClientRectangle(finalSize);
            RadDropDownMenuLayout menuLayout = this.Parent as RadDropDownMenuLayout;
            float leftColumn  = 0;
            float rightColumn = 0;

            if (menuLayout != null)
            {
                leftColumn  = menuLayout.LeftColumnMaxPadding + menuLayout.LeftColumnWidth;
                rightColumn = menuLayout.LeftColumnMaxPadding + menuLayout.RightColumnWidth;
            }

            foreach (RadElement element in this.Children)
            {
                if (element == this.menuElement)
                {
                    if (this.RightToLeft)
                    {
                        element.Arrange(new RectangleF(clientRect.Right - leftColumn - clientRect.Width + (leftColumn + rightColumn), clientRect.Top,
                                                       clientRect.Width - (leftColumn + rightColumn), element.DesiredSize.Height));
                    }
                    else
                    {
                        element.Arrange(new RectangleF(clientRect.Left + leftColumn, clientRect.Top,
                                                       clientRect.Width - (leftColumn + rightColumn), element.DesiredSize.Height));
                    }
                }
                else if (element == this.menuCheckMark)
                {
                    RectangleF rect = new RectangleF(clientRect.X, clientRect.Y, leftColumn, clientRect.Height);
                    if (this.RightToLeft)
                    {
                        rect.X = clientRect.Width - rect.Width;
                    }

                    element.Arrange(rect);
                }
                else if (element.FitToSizeMode == RadFitToSizeMode.FitToParentBounds)
                {
                    element.Arrange(new RectangleF(Point.Empty, finalSize));
                }
                else if (element.FitToSizeMode == RadFitToSizeMode.FitToParentPadding)
                {
                    element.Arrange(new RectangleF(this.BorderThickness.Left, this.BorderThickness.Top, finalSize.Width - this.BorderThickness.Horizontal, finalSize.Height - this.BorderThickness.Vertical));
                }
                else
                {
                    element.Arrange(clientRect);
                }
            }

            return(finalSize);
        }
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF availableSize1         = new SizeF(availableSize);
            RadDropDownMenuLayout parent = this.Parent as RadDropDownMenuLayout;

            if (parent != null)
            {
                availableSize1.Width = availableSize.Width - parent.LeftColumnMaxPadding - parent.LeftColumnWidth;
            }
            this.buttonElement.Measure(availableSize1);
            return(base.MeasureOverride(availableSize));
        }
Beispiel #7
0
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRect = GetClientRectangle(finalSize);
            RadDropDownMenuLayout menuLayout = this.Parent as RadDropDownMenuLayout;
            float leftColumn  = 0;
            float rightColumn = 0;

            if (menuLayout != null)
            {
                leftColumn  = menuLayout.LeftColumnMaxPadding + menuLayout.LeftColumnWidth;
                rightColumn = menuLayout.LeftColumnMaxPadding + menuLayout.RightColumnWidth;
            }

            foreach (RadElement element in this.Children)
            {
                if (element == this.imagePrimitive)
                {
                    float      leftColumnWidth = menuLayout != null ? menuLayout.LeftColumnWidth : 0;
                    RectangleF finalRect       = new RectangleF(clientRect.Left, clientRect.Top, leftColumnWidth, clientRect.Height);
                    if (this.RightToLeft)
                    {
                        finalRect = LayoutUtils.RTLTranslateNonRelative(finalRect, clientRect);
                    }

                    element.Arrange(finalRect);
                }
                else if (element == this.textPrimitive)
                {
                    RectangleF cr = new RectangleF(clientRect.Left + leftColumn, clientRect.Top, clientRect.Width - rightColumn, clientRect.Height);
                    RectangleF r  = LayoutUtils.Align(this.textPrimitive.DesiredSize, cr, this.textPrimitive.Alignment);
                    if (this.RightToLeft)
                    {
                        r = LayoutUtils.RTLTranslateNonRelative(r, clientRect);
                    }

                    element.Arrange(r);
                }
                else if (element.FitToSizeMode == RadFitToSizeMode.FitToParentBounds)
                {
                    element.Arrange(new RectangleF(Point.Empty, finalSize));
                }
                else if (element.FitToSizeMode == RadFitToSizeMode.FitToParentPadding)
                {
                    element.Arrange(new RectangleF(this.BorderThickness.Left, this.BorderThickness.Top, finalSize.Width - this.BorderThickness.Horizontal, finalSize.Height - this.BorderThickness.Vertical));
                }
                else
                {
                    element.Arrange(clientRect);
                }
            }

            return(finalSize);
        }
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRectangle = this.GetClientRectangle(finalSize);
            RadDropDownMenuLayout parent          = this.Parent as RadDropDownMenuLayout;
            int num1 = 0;

            if (parent != null)
            {
                num1 = (int)parent.LeftColumnWidth;
            }
            foreach (RadElement child in this.Children)
            {
                if (child == this.imagePrimitive)
                {
                    RectangleF rectangleF = new RectangleF(clientRectangle.Left, clientRectangle.Top, (float)num1, clientRectangle.Height);
                    if (this.RightToLeft)
                    {
                        rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, clientRectangle);
                    }
                    child.Arrange(rectangleF);
                }
                else if (child == this.contentElement)
                {
                    int num2 = 0;
                    int num3 = 0;
                    if (parent != null)
                    {
                        num2 = (int)parent.LeftColumnMaxPadding;
                        num3 = (int)parent.RightColumnWidth;
                    }
                    RectangleF rectangleF = new RectangleF(clientRectangle.Left + (float)num2 + (float)num1, clientRectangle.Top, clientRectangle.Width - (float)(num2 + num3), clientRectangle.Height);
                    if (this.RightToLeft)
                    {
                        rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, clientRectangle);
                    }
                    child.Arrange(rectangleF);
                }
                else if (child.FitToSizeMode == RadFitToSizeMode.FitToParentBounds)
                {
                    child.Arrange(new RectangleF((PointF)Point.Empty, finalSize));
                }
                else if (child.FitToSizeMode == RadFitToSizeMode.FitToParentPadding)
                {
                    child.Arrange(new RectangleF((float)this.BorderThickness.Left, (float)this.BorderThickness.Top, finalSize.Width - (float)this.BorderThickness.Horizontal, finalSize.Height - (float)this.BorderThickness.Vertical));
                }
                else
                {
                    child.Arrange(clientRectangle);
                }
            }
            return(finalSize);
        }
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRectangle = this.GetClientRectangle(finalSize);
            RadDropDownMenuLayout ancestor        = this.FindAncestor <RadDropDownMenuLayout>();

            if (ancestor != null)
            {
                clientRectangle.X     += this.RightToLeft ? 0.0f : ancestor.LeftColumnWidth;
                clientRectangle.Width -= ancestor.LeftColumnWidth;
            }
            this.checkBoxElement.Arrange(new RectangleF(clientRectangle.X, 0.0f, clientRectangle.Width, this.checkBoxElement.DesiredSize.Height));
            return(finalSize);
        }
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRectangle = this.GetClientRectangle(finalSize);
            RadDropDownMenuLayout parent          = this.Parent as RadDropDownMenuLayout;
            float width = 0.0f;
            float num   = 0.0f;

            if (parent != null)
            {
                width = parent.LeftColumnMaxPadding + parent.LeftColumnWidth;
                num   = parent.LeftColumnMaxPadding + parent.RightColumnWidth;
            }
            foreach (RadElement child in this.Children)
            {
                if (child == this.menuElement)
                {
                    if (this.RightToLeft)
                    {
                        child.Arrange(new RectangleF((float)((double)clientRectangle.Right - (double)width - (double)clientRectangle.Width + ((double)width + (double)num)), clientRectangle.Top, clientRectangle.Width - (width + num), child.DesiredSize.Height));
                    }
                    else
                    {
                        child.Arrange(new RectangleF(clientRectangle.Left + width, clientRectangle.Top, clientRectangle.Width - (width + num), child.DesiredSize.Height));
                    }
                }
                else if (child == this.menuCheckMark)
                {
                    RectangleF finalRect = new RectangleF(clientRectangle.X, clientRectangle.Y, width, clientRectangle.Height);
                    if (this.RightToLeft)
                    {
                        finalRect.X = clientRectangle.Width - finalRect.Width;
                    }
                    child.Arrange(finalRect);
                }
                else if (child.FitToSizeMode == RadFitToSizeMode.FitToParentBounds)
                {
                    child.Arrange(new RectangleF((PointF)Point.Empty, finalSize));
                }
                else if (child.FitToSizeMode == RadFitToSizeMode.FitToParentPadding)
                {
                    child.Arrange(new RectangleF((float)this.BorderThickness.Left, (float)this.BorderThickness.Top, finalSize.Width - (float)this.BorderThickness.Horizontal, finalSize.Height - (float)this.BorderThickness.Vertical));
                }
                else
                {
                    child.Arrange(clientRectangle);
                }
            }
            return(finalSize);
        }
Beispiel #11
0
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            float                 width           = 0.0f;
            RectangleF            clientRectangle = this.GetClientRectangle(finalSize);
            RadDropDownMenuLayout menuLayout      = ((RadMenuItem)this.Parent).MenuLayout;

            if (menuLayout != null)
            {
                width = menuLayout.RightColumnWidth;
            }
            else if (this.arrowPrimitive != null)
            {
                width = this.arrowPrimitive.DesiredSize.Width;
            }
            foreach (RadElement child in this.Children)
            {
                if (child.FitToSizeMode == RadFitToSizeMode.FitToParentBounds)
                {
                    child.Arrange(new RectangleF((PointF)Point.Empty, finalSize));
                }
                else if (child.FitToSizeMode == RadFitToSizeMode.FitToParentPadding)
                {
                    child.Arrange(new RectangleF((float)this.BorderThickness.Left, (float)this.BorderThickness.Top, finalSize.Width - (float)this.BorderThickness.Horizontal, finalSize.Height - (float)this.BorderThickness.Vertical));
                }
                else
                {
                    RectangleF rectangleF = new RectangleF(new PointF(clientRectangle.Left, clientRectangle.Top), child.DesiredSize);
                    if (this.IsRightColumnElement(child))
                    {
                        rectangleF = new RectangleF(clientRectangle.Right - width, clientRectangle.Top, width, clientRectangle.Bottom);
                    }
                    else if (this.IsLeftContent(child))
                    {
                        rectangleF = new RectangleF(clientRectangle.Left, clientRectangle.Top, child.DesiredSize.Width, clientRectangle.Bottom);
                    }
                    else if (this.IsRightContent(child))
                    {
                        rectangleF = new RectangleF(clientRectangle.Right - child.DesiredSize.Width - width, clientRectangle.Top, child.DesiredSize.Width, clientRectangle.Bottom);
                    }
                    if (this.RightToLeft)
                    {
                        rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, clientRectangle);
                    }
                    child.Arrange(rectangleF);
                }
            }
            return(finalSize);
        }
Beispiel #12
0
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRectangle = this.GetClientRectangle(finalSize);
            RadDropDownMenuLayout parent          = this.Parent as RadDropDownMenuLayout;
            float num1 = 0.0f;
            float num2 = 0.0f;

            if (parent != null)
            {
                num1 = parent.LeftColumnMaxPadding + parent.LeftColumnWidth;
                num2 = parent.LeftColumnMaxPadding + parent.RightColumnWidth;
            }
            foreach (RadElement child in this.Children)
            {
                if (child == this.imagePrimitive)
                {
                    float      width      = parent != null ? parent.LeftColumnWidth : 0.0f;
                    RectangleF rectangleF = new RectangleF(clientRectangle.Left, clientRectangle.Top, width, clientRectangle.Height);
                    if (this.RightToLeft)
                    {
                        rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, clientRectangle);
                    }
                    child.Arrange(rectangleF);
                }
                else if (child == this.textPrimitive)
                {
                    RectangleF rectangleF = LayoutUtils.Align(this.textPrimitive.DesiredSize, new RectangleF(clientRectangle.Left + num1, clientRectangle.Top, clientRectangle.Width - num2, clientRectangle.Height), this.textPrimitive.Alignment);
                    if (this.RightToLeft)
                    {
                        rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, clientRectangle);
                    }
                    child.Arrange(rectangleF);
                }
                else if (child.FitToSizeMode == RadFitToSizeMode.FitToParentBounds)
                {
                    child.Arrange(new RectangleF((PointF)Point.Empty, finalSize));
                }
                else if (child.FitToSizeMode == RadFitToSizeMode.FitToParentPadding)
                {
                    child.Arrange(new RectangleF((float)this.BorderThickness.Left, (float)this.BorderThickness.Top, finalSize.Width - (float)this.BorderThickness.Horizontal, finalSize.Height - (float)this.BorderThickness.Vertical));
                }
                else
                {
                    child.Arrange(clientRectangle);
                }
            }
            return(finalSize);
        }
Beispiel #13
0
        protected override void CreateChildElements()
        {
            this.fill       = new FillPrimitive();
            this.fill.Class = "RadSubMenuPanelBackFillPrimitive";
            this.Children.Add(this.fill);

            this.border       = new BorderPrimitive();
            this.border.Class = "RadSubMenuPanelBorderPrimitive";
            this.Children.Add(this.border);

            leftColumnElement       = new RadElement();
            leftColumnElement.Class = "RadSubMenuPanelLeftElement";
            this.Children.Add(leftColumnElement);

            leftColumnFill       = new FillPrimitive();
            leftColumnFill.Class = "RadSubMenuPanelFillPrimitive";
            leftColumnElement.Children.Add(leftColumnFill);

            leftColumnBorder       = new BorderPrimitive();
            leftColumnBorder.Class = "RadSubMenuPanelLeftBorderPrimitive";
            leftColumnElement.Children.Add(leftColumnBorder);

            StackLayoutPanel panel = new StackLayoutPanel();

            panel.Orientation = Orientation.Horizontal;
            panel.ZIndex      = 1;
            this.Children.Add(panel);

            panel.Children.Add(CreateHeaderColumnElement());

            this.layoutPanel = CreateMenuLayout();

            if (GetBitState(UseScrollingStateKey))
            {
                this.scrollViewer = new RadScrollViewer();

                this.scrollViewer.ShowBorder = false;
                this.scrollViewer.ShowFill   = false;
                this.scrollViewer.Viewport   = this.layoutPanel;
                panel.Children.Add(this.scrollViewer);
            }
            else
            {
                panel.Children.Add(this.layoutPanel);
            }
        }
Beispiel #14
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF sizeF = base.MeasureOverride(availableSize);

            if (this.hostedControl == null)
            {
                return(sizeF);
            }
            RadDropDownMenuLayout parent = this.Parent as RadDropDownMenuLayout;
            SizeF size = (SizeF)this.hostedControl.Size;

            if (parent != null)
            {
                size.Width -= (float)parent.RightColumnPadding + parent.LeftColumnMaxPadding + (float)parent.Padding.Horizontal;
            }
            return(size);
        }
Beispiel #15
0
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            base.ArrangeOverride(finalSize);
            RadDropDownMenuLayout ancestor = this.FindAncestor <RadDropDownMenuLayout>();

            if (ancestor != null && this.linePrimitive != null)
            {
                RectangleF finalRect = new RectangleF(ancestor.LeftColumnWidth + ancestor.LeftColumnMaxPadding + this.cachedLineOffset, (float)((double)finalSize.Height / 2.0 - (double)this.linePrimitive.DesiredSize.Height / 2.0), finalSize.Width - (ancestor.LeftColumnWidth + ancestor.LeftColumnMaxPadding), finalSize.Height);
                if (this.RightToLeft)
                {
                    finalRect.X = finalSize.Width - finalRect.X - finalRect.Width;
                }
                this.linePrimitive.Arrange(finalRect);
                finalRect = new RectangleF(finalRect.X, (float)((double)finalSize.Height / 2.0 - (double)this.text.DesiredSize.Height / 2.0), finalRect.Width, finalRect.Height);
                this.text.Arrange(finalRect);
            }
            return(finalSize);
        }
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            base.ArrangeOverride(finalSize);
            RadDropDownMenuLayout menuLayout = FindAncestor <RadDropDownMenuLayout>();

            if (menuLayout != null && this.linePrimitive != null)
            {
                RectangleF rect = new RectangleF(menuLayout.LeftColumnWidth + menuLayout.LeftColumnMaxPadding + this.cachedLineOffset, 0f,
                                                 finalSize.Width - (menuLayout.LeftColumnWidth + menuLayout.LeftColumnMaxPadding), finalSize.Height);
                if (this.RightToLeft)
                {
                    rect.X = finalSize.Width - rect.X - rect.Width;
                }

                this.linePrimitive.Arrange(rect);
            }
            return(finalSize);
        }
Beispiel #17
0
 protected override SizeF ArrangeOverride(SizeF finalSize)
 {
     foreach (RadElement child in this.Children)
     {
         RectangleF finalRect = new RectangleF(PointF.Empty, finalSize);
         if (child == this.treeElement)
         {
             finalRect = this.GetClientRectangle(finalSize);
             RadDropDownMenuLayout ancestor = this.FindAncestor <RadDropDownMenuLayout>();
             if (ancestor != null)
             {
                 finalRect.X     += this.RightToLeft ? 0.0f : ancestor.LeftColumnWidth;
                 finalRect.Width -= ancestor.LeftColumnWidth;
             }
             this.treeElement.TreeView.Size = finalRect.Size.ToSize();
         }
         child.Arrange(finalRect);
     }
     return(finalSize);
 }
Beispiel #18
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF size = base.MeasureOverride(availableSize);

            if (this.hostedControl != null)
            {
                //TFS:106664
                //We need to extract the following values from the width because the menu layout adds them on upper levels
                //(RadDropDownMenuLayout, RadDropDownMenuElement). Other RadMenuItems handle the added values while
                //RadMenuHostItem fits the hosted control to the available size and the dropdown size is increased everytime.
                RadDropDownMenuLayout menuLayout = this.Parent as RadDropDownMenuLayout;
                size = this.hostedControl.Size;
                if (menuLayout != null)
                {
                    size.Width -= 2 * menuLayout.LeftColumnWidth + menuLayout.LeftColumnMaxPadding + menuLayout.Padding.Horizontal;
                }

                return(size);
            }
            return(size);
        }
Beispiel #19
0
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRectangle = this.GetClientRectangle(finalSize);
            RadDropDownMenuLayout ancestor        = this.FindAncestor <RadDropDownMenuLayout>();

            if (ancestor != null)
            {
                clientRectangle.X     += this.RightToLeft ? 0.0f : ancestor.LeftColumnWidth;
                clientRectangle.Width -= ancestor.LeftColumnWidth;
            }
            foreach (RadElement child in this.Children)
            {
                if (child == this.list)
                {
                    child.Arrange(new RectangleF(clientRectangle.X, 0.0f, clientRectangle.Width, clientRectangle.Height));
                }
                else
                {
                    child.Arrange(clientRectangle);
                }
            }
            return(finalSize);
        }
        private void OnMenuItem_DropDownOpening(object sender, CancelEventArgs e)
        {
            if (this.IsDesignMode)
            {
                return;
            }

            RadMenuItemBase menuItem = sender as RadMenuItemBase;

            if (menuItem != null)
            {
                RadPopupOpeningEventArgs eventArgs = e as RadPopupOpeningEventArgs;
                if (menuItem.Parent is RadDropDownMenuLayout)
                {
                    RadDropDownMenuLayout parentLayout = menuItem.Parent as RadDropDownMenuLayout;
                    eventArgs.CustomLocation = new System.Drawing.Point(eventArgs.CustomLocation.X,
                                                                        parentLayout.ControlBoundingRectangle.Y + this.DropDownMenu.Location.Y);

                    RadDropDownMenu     dropDownMenu = menuItem.DropDown;
                    System.Drawing.Size popupSize    = new System.Drawing.Size(dropDownMenu.Width, parentLayout.ControlBoundingRectangle.Height);
                    dropDownMenu.MinimumSize = popupSize;
                }
            }
        }
Beispiel #21
0
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            RectangleF            clientRect = GetClientRectangle(finalSize);
            RadDropDownMenuLayout menuLayout = this.Parent as RadDropDownMenuLayout;
            int leftColumnWidth = 0;

            if (menuLayout != null)
            {
                leftColumnWidth = (int)menuLayout.LeftColumnWidth;
            }

            foreach (RadElement element in this.Children)
            {
                if (element == this.imagePrimitive)
                {
                    RectangleF finalRect = new RectangleF(clientRect.Left, clientRect.Top, leftColumnWidth, clientRect.Height);
                    if (this.RightToLeft)
                    {
                        finalRect = LayoutUtils.RTLTranslateNonRelative(finalRect, clientRect);
                    }

                    element.Arrange(finalRect);
                }
                else if (element == this.contentElement)
                {
                    int leftColumnPadding = 0;
                    int rightColumnWidth  = 0;

                    if (menuLayout != null)
                    {
                        leftColumnPadding = (int)menuLayout.LeftColumnMaxPadding;
                        rightColumnWidth  = (int)menuLayout.RightColumnWidth;
                    }

                    RectangleF finalRect = new RectangleF(
                        clientRect.Left + leftColumnPadding + leftColumnWidth,
                        clientRect.Top,
                        clientRect.Width - (leftColumnPadding + rightColumnWidth),
                        clientRect.Height);

                    if (this.RightToLeft)
                    {
                        finalRect = LayoutUtils.RTLTranslateNonRelative(finalRect, clientRect);
                    }

                    element.Arrange(finalRect);
                }
                else if (element.FitToSizeMode == RadFitToSizeMode.FitToParentBounds)
                {
                    element.Arrange(new RectangleF(Point.Empty, finalSize));
                }
                else if (element.FitToSizeMode == RadFitToSizeMode.FitToParentPadding)
                {
                    element.Arrange(new RectangleF(this.BorderThickness.Left, this.BorderThickness.Top, finalSize.Width - this.BorderThickness.Horizontal, finalSize.Height - this.BorderThickness.Vertical));
                }
                else
                {
                    element.Arrange(clientRect);
                }
            }

            return(finalSize);
        }
Beispiel #22
0
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            float                 leftColumnWidth  = 0;
            float                 rightColumnWidth = 0;
            RectangleF            clientRect       = GetClientRectangle(finalSize);
            RadDropDownMenuLayout menuLayout       = ((RadMenuItem)this.Parent).MenuLayout;

            if (menuLayout != null)
            {
                leftColumnWidth  = menuLayout.LeftColumnWidth;
                rightColumnWidth = menuLayout.RightColumnWidth;
            }
            else
            {
                if (this.checkmark != null && this.imagePrimitive != null)
                {
                    leftColumnWidth = Math.Max(checkmark.DesiredSize.Width, imagePrimitive.DesiredSize.Width);
                }
                if (this.arrowPrimitive != null)
                {
                    rightColumnWidth = this.arrowPrimitive.DesiredSize.Width;
                }
            }

            foreach (RadElement element in this.Children)
            {
                if (element.FitToSizeMode == RadFitToSizeMode.FitToParentBounds)
                {
                    element.Arrange(new RectangleF(Point.Empty, finalSize));
                }
                else if (element.FitToSizeMode == RadFitToSizeMode.FitToParentPadding)
                {
                    element.Arrange(new RectangleF(this.BorderThickness.Left, this.BorderThickness.Top, finalSize.Width - this.BorderThickness.Horizontal, finalSize.Height - this.BorderThickness.Vertical));
                }
                else
                {
                    RectangleF finalRect = new RectangleF(new PointF(clientRect.Left, clientRect.Top), element.DesiredSize);

                    if (IsRightColumnElement(element))
                    {
                        finalRect = new RectangleF(clientRect.Right - rightColumnWidth, clientRect.Top, rightColumnWidth, clientRect.Bottom);
                    }
                    else if (IsLeftContent(element))
                    {
                        finalRect = new RectangleF(clientRect.Left, clientRect.Top, element.DesiredSize.Width, clientRect.Bottom);
                    }
                    else if (IsRightContent(element))
                    {
                        finalRect = new RectangleF(clientRect.Right - element.DesiredSize.Width - rightColumnWidth, clientRect.Top, element.DesiredSize.Width, clientRect.Bottom);
                    }

                    if (this.RightToLeft)
                    {
                        finalRect = LayoutUtils.RTLTranslateNonRelative(finalRect, clientRect);
                    }

                    element.Arrange(finalRect);
                }
            }

            return(finalSize);
        }