public override bool OnMouseWheel(Control target, int delta)
        {
            RadApplicationMenuDropDownElement element = this.PopupElement as RadApplicationMenuDropDownElement;

            if (element == null)
            {
                return(false);
            }

            if (element.MenuElement.ScrollPanel.VerticalScrollBar.Visibility != ElementVisibility.Visible)
            {
                return(true);
            }

            if (delta > 0)
            {
                element.MenuElement.ScrollPanel.LineUp();
            }
            else
            {
                element.MenuElement.ScrollPanel.LineDown();
            }

            return(true);
        }
Esempio n. 2
0
        protected override System.Drawing.SizeF ApplySizeConstraints(System.Drawing.SizeF desiredSize)
        {
            RadApplicationMenuDropDownElement dropDownElement = this.FindAncestor <RadApplicationMenuDropDownElement>();

            if (dropDownElement == null)
            {
                return(desiredSize);
            }

            SizeF dropDownElementSize = dropDownElement.DesiredSize;
            SizeF clampedSize         = base.ApplySizeConstraints(dropDownElement.DesiredSize.ToSize());

            float clampMargin   = dropDownElementSize.Height - clampedSize.Height;
            float clampedWidth  = 0;
            float clampedHeight = 0;

            if (!this.cachedVerticalClampMargin.HasValue || clampMargin > 0)
            {
                this.cachedVerticalClampMargin = clampMargin;
            }

            clampMargin = dropDownElementSize.Width - clampedSize.Width;

            if (!this.cachedHorizontalClampMargin.HasValue || clampMargin > 0)
            {
                this.cachedHorizontalClampMargin = clampMargin;
            }

            clampedWidth  = desiredSize.Width - cachedHorizontalClampMargin.Value;
            clampedHeight = desiredSize.Height - cachedVerticalClampMargin.Value;
            return(new SizeF(clampedWidth, clampedHeight));
        }
        protected override RadElement CreatePopupElement()
        {
            RadApplicationMenuDropDownElement popupElement = new RadApplicationMenuDropDownElement();

            this.Items.Owner            = popupElement.MenuElement.LayoutPanel;
            this.RightColumnItems.Owner = popupElement.TopRightContentElement.Layout;
            this.buttonItems.Owner      = popupElement.BottomContentElement.Layout;
            return(popupElement);
        }
        protected override void ShowCore(Point point, int ownerOffset, RadDirection popupDirection)
        {
            RadApplicationMenuDropDown        dropDown    = (RadApplicationMenuDropDown)this.ElementTree.Control;
            RadApplicationMenuDropDownElement menuElement = dropDown.PopupElement as RadApplicationMenuDropDownElement;

            if (menuElement != null && !this.IsDesignMode)
            {
                Size size = menuElement.TopRightContentElement.Layout.Size;
                size.Width  -= 3;
                size.Height -= 3;
                this.PopupElement.MinSize = size;
                this.PopupElement.SetValue(RadDropDownMenuElement.DropDownPositionProperty, DropDownPosition.RightPopupContent);
            }

            base.ShowCore(point, ownerOffset, popupDirection);
        }
Esempio n. 5
0
        protected override void ShowCore(Point point, int ownerOffset, RadDirection popupDirection)
        {
            RadApplicationMenuDropDownElement popupElement = ((RadDropDownMenu)this.ElementTree.Control).PopupElement as RadApplicationMenuDropDownElement;

            if (popupElement != null && !this.IsDesignMode)
            {
                popupElement.InvalidateMeasure(true);
                popupElement.UpdateLayout();
                Size size = popupElement.TopRightContentElement.Layout.Size;
                size.Width  -= 3;
                size.Height -= 3;
                this.PopupElement.MinSize = size;
                int num = (int)this.PopupElement.SetValue(RadDropDownMenuElement.DropDownPositionProperty, (object)DropDownPosition.RightPopupContent);
            }
            base.ShowCore(point, ownerOffset, popupDirection);
        }
        protected override void OnDropDownOpening(System.ComponentModel.CancelEventArgs e)
        {
            base.OnDropDownOpening(e);
            if (this.IsDesignMode)
            {
                RadApplicationMenuDropDownElement dropDownElement = this.DropDownMenu.PopupElement as RadApplicationMenuDropDownElement;
                if (dropDownElement != null)
                {
                    dropDownElement.MenuElement.SetValue(RadDropDownMenuElement.DropDownPositionProperty, DropDownPosition.LeftContent);
                    dropDownElement.TopRightContentElement.SetValue(RadDropDownMenuElement.DropDownPositionProperty, DropDownPosition.RightContent);

                    foreach (RadElement element in dropDownElement.TopRightContentElement.ChildrenHierarchy)
                    {
                        element.SetValue(RadDropDownMenuElement.DropDownPositionProperty, DropDownPosition.RightContent);
                    }
                }
            }
        }
        protected override void OnDropDownOpening(CancelEventArgs e)
        {
            base.OnDropDownOpening(e);
            if (!this.IsDesignMode)
            {
                return;
            }
            RadApplicationMenuDropDownElement popupElement = this.DropDownMenu.PopupElement as RadApplicationMenuDropDownElement;

            if (popupElement == null)
            {
                return;
            }
            int num1 = (int)popupElement.MenuElement.SetValue(RadDropDownMenuElement.DropDownPositionProperty, (object)DropDownPosition.LeftContent);
            int num2 = (int)popupElement.TopRightContentElement.SetValue(RadDropDownMenuElement.DropDownPositionProperty, (object)DropDownPosition.RightContent);

            foreach (RadObject radObject in popupElement.TopRightContentElement.ChildrenHierarchy)
            {
                int num3 = (int)radObject.SetValue(RadDropDownMenuElement.DropDownPositionProperty, (object)DropDownPosition.RightContent);
            }
        }
        protected override SizeF ApplySizeConstraints(SizeF desiredSize)
        {
            RadApplicationMenuDropDownElement ancestor = this.FindAncestor <RadApplicationMenuDropDownElement>();

            if (ancestor == null)
            {
                return(desiredSize);
            }
            SizeF desiredSize1 = ancestor.DesiredSize;
            SizeF sizeF        = base.ApplySizeConstraints((SizeF)ancestor.DesiredSize.ToSize());
            float num1         = desiredSize1.Height - sizeF.Height;

            if (!this.cachedVerticalClampMargin.HasValue || (double)num1 > 0.0)
            {
                this.cachedVerticalClampMargin = new float?(num1);
            }
            float num2 = desiredSize1.Width - sizeF.Width;

            if (!this.cachedHorizontalClampMargin.HasValue || (double)num2 > 0.0)
            {
                this.cachedHorizontalClampMargin = new float?(num2);
            }
            return(new SizeF(desiredSize.Width - this.cachedHorizontalClampMargin.Value, desiredSize.Height - this.cachedVerticalClampMargin.Value));
        }