Пример #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                RadElement elementAtPoint = this.ElementTree.GetElementAtPoint(e.Location);
                if ((!(elementAtPoint is CommandBarRowElement) &&
                     !(elementAtPoint is RadCommandBarElement)) &&
                    (elementAtPoint != null))
                {
                    return;
                }

                contextMenu.Items.Clear();
                contextMenu.RightToLeft = this.RightToLeft;
                contextMenu.ThemeName   = this.ThemeName;
                foreach (CommandBarStripElement stripInfo in this.CommandBarElement.StripInfoHolder.StripInfoList)
                {
                    CommandBarDropDownMenu item = new CommandBarDropDownMenu(stripInfo);
                    item.Text      = stripInfo.DisplayName;
                    item.IsChecked = stripInfo.VisibleInCommandBar;
                    contextMenu.Items.Add(item);
                }

                contextMenu.Items.Add(new RadMenuSeparatorItem());
                customizeMenuItem.Text = CommandBarLocalizationProvider.CurrentProvider.GetLocalizedString(CommandBarStringId.ContextMenuCustomizeText);
                contextMenu.Items.Add(customizeMenuItem);
                contextMenu.Show(this.PointToScreen(e.Location));
            }
        }
Пример #2
0
 public virtual bool ShowContextMenu(IContextMenuProvider contextMenuProvider, Point location)
 {
   if (this.rootElement == null)
     return false;
   RadDropDownMenu radDropDownMenu = contextMenuProvider.ContextMenu ?? contextMenuProvider.MergeMenus((IContextMenuManager) this);
   GridViewContextMenuManager.UpdateMenuTheme((GridVisualElement) this.rootElement, radDropDownMenu);
   ContextMenuOpeningEventArgs args = new ContextMenuOpeningEventArgs(contextMenuProvider, radDropDownMenu);
   this.rootElement.Template.EventDispatcher.RaiseEvent<ContextMenuOpeningEventArgs>(EventDispatcher.ContextMenuOpening, (object) contextMenuProvider, args);
   RadDropDownMenu contextMenu = args.ContextMenu;
   if (args.Cancel || contextMenu == null || contextMenu.Items.Count == 0)
     return false;
   if (this.rootElement.RightToLeft)
   {
     contextMenu.RightToLeft = RightToLeft.Yes;
   }
   else
   {
     contextMenu.RightToLeft = RightToLeft.No;
     contextMenu.HorizontalPopupAlignment = HorizontalPopupAlignment.LeftToLeft;
   }
   contextMenu.Show(this.rootElement.ElementTree.Control, location);
   this.contextMenu = contextMenu;
   this.contextMenu.PopupClosed += new RadPopupClosedEventHandler(this.ContextMenu_PopupClosed);
   return true;
 }
        public virtual void ShowDropdown()
        {
            if (this.Items.Count == 0)
            {
                return;
            }

            RadControl parentControl = (this.ElementTree.Control as RadControl);

            if (parentControl != null)
            {
                dropDownMenu.ThemeName = parentControl.ThemeName;
            }

            dropDownMenu.RightToLeft = (this.RightToLeft) ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.No;
            dropDownMenu.Show(this, 0, this.Size.Height);
        }
        private void FilterFunctionButton_Click(object sender, EventArgs e)
        {
            RadDropDownMenu filterMenu = this.CreateFilterMenu();

            filterMenu.RightToLeft = this.RightToLeft ? RightToLeft.Yes : RightToLeft.No;
            bool  flag  = filterMenu.RightToLeft == RightToLeft.Yes;
            Point point = flag ? new Point(this.filterFunctionButton.Size.Width, this.filterFunctionButton.Size.Height) : new Point(0, this.filterFunctionButton.Size.Height);
            VirtualGridContextMenuOpeningEventArgs args = new VirtualGridContextMenuOpeningEventArgs(this.RowIndex, this.ColumnIndex, this.ViewInfo, filterMenu);

            if (!this.TableElement.GridElement.OnContextMenuOpening(args) || args.ContextMenu == null || args.ContextMenu.Items.Count <= 0)
            {
                return;
            }
            filterMenu.HorizontalPopupAlignment = flag ? HorizontalPopupAlignment.RightToRight : HorizontalPopupAlignment.LeftToLeft;
            filterMenu.ThemeName = this.ElementTree.ThemeName;
            filterMenu.Show((RadItem)this.filterFunctionButton, point, RadDirection.Down);
            this.Focus();
        }