Table of Contents

Customize the Main Menu

Parts of the Menu

Main menu

  1. Menu bar
  2. Menu
  3. Menu Group
  4. Command menu item for a command
  5. Command menu item, the command handler can set the Checked property
  6. Command menu item, for a command list
  7. Text menu item

Simple Example

This example adds a MenuItemGroup with a CommandMenuItem to the bottom of the ViewMenu.

[Export]
public static MenuItemGroupDefinition MyMenuGroup { get; }
    = new MenuItemGroupDefinition(
        parent: Gemini.Modules.MainMenu.MenuDefinitions.ViewMenu,
        sortOrder: 100);

[Export]
public static MenuItemDefinition MyCommandMenuItemDefinition { get; }
    = new CommandMenuItemDefinition<MyCommandDefinition>(
        group: MyMenuItemGroupDefinition,
        sortOrder: 0);

Exclude Defined Menus and Menu Items

You can exclude already defined menus, menu groups, and menu items by exporting an exclude definition.

See:

This example removes the help menu.

internal static class ExcludeMenuDefinitions
{
    [Export]
    public static ExcludeMenuDefinition ExcludeHelpMenuDefinition { get; }
        = new ExcludeMenuDefinition(Gemini.Modules.MainMenu.MenuDefinitions.HelpMenu);
}

See Also