콘텐츠로 이동

MenuItem class

이 콘텐츠는 아직 번역되지 않았습니다.

A menu entry that presents a command or opens a submenu.

Guide: C# Markup reference: Menu

public sealed class MenuItem : MenuEntry
name description
MenuItem() The default constructor.
MenuItem(…) Creates a presentation-only item. A single underscore in text marks the following character as the access key; use a double underscore for a literal underscore. (4 constructors)
CanClick { get; set; } Asked whether the row can be clicked, for a row whose condition is local enough that a command would be ceremony. Combined with IsEnabled and with the command’s own answer rather than replacing either, so any of the three disables the row.
Command { get; set; } Gets or sets the semantic command this item invokes.
CommandData { get; set; }
Icon { get; set; } Gets or sets this placement’s icon override.
IsCheckable { get; set; }
IsChecked { get; set; }
IsEnabled { get; set; } Gets or sets the local enabled state, which the command’s CanExecute is combined with rather than replacing.
SubMenu { get; set; } Gets or sets the submenu this item opens, or null for a leaf item.
Text { get; set; } Gets or sets this placement’s presentation text override, in which a single underscore marks the following character as the access key.
override ToString()
static readonly CommandDataProperty The value this placement hands its command as the invocation argument, so several items can share one command and differ only in what they pass. Null lets the argument the menu captured when it opened (the item it opened over) stand in.
static readonly CommandProperty
static readonly IconProperty
static readonly IsCheckableProperty Whether the item has a check slot. The slot is the icon column, which a menu with such an item keeps whether or not any check is currently shown; the item’s own icon is not shown.
static readonly IsCheckedProperty Whether the check is shown in the slot of an item that IsCheckable. Clicking the item does not change it: the application sets it, usually from the state its command changes.
static readonly IsEnabledProperty
static readonly SubMenuProperty
static readonly TextProperty