Beispiel #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));
            }
        }
Beispiel #2
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            if (e.Button != MouseButtons.Right)
            {
                return;
            }
            RadElement elementAtPoint = this.ElementTree.GetElementAtPoint(e.Location);

            if (!(elementAtPoint is CommandBarRowElement) && !(elementAtPoint is RadCommandBarElement) && elementAtPoint != null)
            {
                return;
            }
            this.contextMenu.Items.Clear();
            this.contextMenu.RightToLeft = this.RightToLeft;
            this.contextMenu.ThemeName   = this.ThemeName;
            foreach (CommandBarStripElement stripInfo in this.CommandBarElement.StripInfoHolder.StripInfoList)
            {
                CommandBarDropDownMenu commandBarDropDownMenu = new CommandBarDropDownMenu(stripInfo);
                commandBarDropDownMenu.Text      = stripInfo.DisplayName;
                commandBarDropDownMenu.IsChecked = stripInfo.VisibleInCommandBar;
                this.contextMenu.Items.Add((RadItem)commandBarDropDownMenu);
            }
            this.contextMenu.Items.Add((RadItem) new RadMenuSeparatorItem());
            this.customizeMenuItem.Text = LocalizationProvider <CommandBarLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuCustomizeText");

            this.contextMenu.Items.Add((RadItem)this.customizeMenuItem);
            this.contextMenu.Show(this.PointToScreen(e.Location));
        }