Example #1
0
        /// <summary>
        /// Shows the drop down items of the button, as if the dropdown part has been clicked
        /// </summary>
        public void ShowDropDown()
        {
            if (Style == RibbonButtonStyle.Normal || DropDownItems.Count == 0)
            {
                if (DropDown != null)
                {
                    RibbonPopupManager.DismissChildren(DropDown, RibbonPopupManager.DismissReason.NewPopup);
                }
                return;
            }

            if (Style == RibbonButtonStyle.DropDown)
            {
                SetPressed(true);
            }
            else
            {
                _dropDownPressed = true;
            }



            CreateDropDown();
            DropDown.MouseEnter    += new EventHandler(DropDown_MouseEnter);
            DropDown.Closed        += new EventHandler(_dropDown_Closed);
            DropDown.ShowSizingGrip = DropDownResizable;

            RibbonPopup canvasdd = Canvas as RibbonPopup;
            Point       location = OnGetDropDownMenuLocation();
            Size        minsize  = OnGetDropDownMenuSize();

            if (!minsize.IsEmpty)
            {
                DropDown.MinimumSize = minsize;
            }

            OnDropDownShowing(EventArgs.Empty);
            SetDropDownVisible(true);
            DropDown.SelectionService = GetService(typeof(ISelectionService)) as ISelectionService;
            DropDown.Show(location);
        }