ClearMenuItems() private static method

private static ClearMenuItems ( MenuItemCollection menuItemCollection ) : void
menuItemCollection MenuItemCollection
return void
Example #1
0
 protected override void Dispose(bool disposing)
 {
     System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType() + ". ****** ");
     if (disposing && !IsDisposed)
     {
         CommandBarContextMenu.ClearMenuItems(MenuItems);
         IsDisposed = true;
     }
     base.Dispose(disposing);
 }
Example #2
0
            private void UpdateItems()
            {
                this.OwnerDraw = true;

                CommandBarSeparator separator = this.item as CommandBarSeparator;

                if (separator != null)
                {
                    this.Text = "-";
                }
                else
                {
                    this.Text = (this.mnemonics) ? this.item.Text : this.item.Text.Replace("&", "");
                }

                CommandBarMenu menu = this.item as CommandBarMenu;

                if (menu != null)
                {
                    CommandBarContextMenu.ClearMenuItems(MenuItems);

                    Size imageSize = GetImageSize(menu.Items);

                    int visibleItemCount = 0;
                    foreach (CommandBarItem item in menu.Items)
                    {
                        this.MenuItems.Add(new MenuBarItem(item, imageSize, font, mnemonics));
                        visibleItemCount += (item.IsVisible) ? 1 : 0;
                    }

                    this.Enabled = (visibleItemCount == 0) ? false : this.item.IsEnabled;
                }
                else
                {
                    this.Enabled = this.item.IsEnabled;
                }

                this.Visible = this.item.IsVisible;
            }