internal void HandleDesignerItemRemoved(RibbonItem item)
        {
            if (MenuItems.Contains(item))
            {
                MenuItems.Remove(item);
            }
            else if (RecentItems.Contains(item))
            {
                RecentItems.Remove(item);
            }
            else if (OptionItems.Contains(item))
            {
                OptionItems.Remove(item);
            }

            OnRegionsChanged();
        }
Example #2
0
        protected override void OnClosing(ToolStripDropDownClosingEventArgs e)
        {
            base.OnClosing(e);

            if (RibbonInDesignMode)
            {
                RibbonItem item = RibbonDesigner.Current.SelectedElement as RibbonItem;
                e.Cancel = item != null &&
                           (MenuItems.Contains(item) || RecentItems.Contains(item) || OptionItems.Contains(item)) &&
                           e.CloseReason != ToolStripDropDownCloseReason.Keyboard &&
                           e.CloseReason != ToolStripDropDownCloseReason.AppClicked;
            }
            else
            {
                Console.WriteLine(e.CloseReason.ToString());
            }
        }