Skip to content

MenuExtensions.Item method (1 of 8)

Adds a semantic command item using the command’s normalized text and default access key.

public static Menu Item(this Menu menu, Command command)

Adds a command item using the command’s normalized text and default access key.

public static MenuBar Item(this MenuBar bar, Command command)

Adds a menu item.

public static MenuBar Item(this MenuBar bar, MenuItem item)
parameter description
bar Target menu bar.
item Menu item to add.

The menu bar for chaining.


Adds a non-executable presentation item.

public static Menu Item(this Menu menu, string text, bool isEnabled = true)

Adds a semantic command item with a presentation and access-key override. A single underscore marks the following character as the access key; use a double underscore for a literal underscore.

public static Menu Item(this Menu menu, string text, Command command)

Adds a command item with a presentation and access-key override. A single underscore marks the following character as the access key; use a double underscore for a literal underscore.

public static MenuBar Item(this MenuBar bar, string text, Command command)

Adds a menu item with text and submenu.

public static MenuBar Item(this MenuBar bar, string text, Menu menu)
parameter description
bar Target menu bar.
text Menu item text.
menu Submenu.

The menu bar for chaining.


Adds a command item that passes data as the invocation argument, so several items can share one command and differ only in the value they pass.

public static Menu Item(this Menu menu, string text, Command command, object? data)