콘텐츠로 이동

ContextMenu class

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

A context menu popup control for displaying menu items.

Guide: C# Markup reference: Menu

public sealed class ContextMenu : Control, IPopupOwner
name description
ContextMenu() Initializes a new instance of the ContextMenu class.
ContextMenu(…) Initializes a new instance of the ContextMenu class with a menu model.
ItemHeight { get; set; } Gets or sets the height of menu items.
ItemPadding { get; set; } Gets or sets the padding around menu items.
Items { get; } Gets the menu items collection.
MaxMenuHeight { get; set; } Gets or sets an upper bound on the menu height; the default is no bound.
Menu { get; } Gets the menu model.
Placement { get; set; } Gets or sets where the menu opens relative to its placement target.
PlacementOffset { get; set; } Gets or sets a DIP offset applied to the placement, mirrored on the flipped side.
PlacementTarget { get; } Gets the element the menu last opened on. Set by Show and kept until the next show, so a handler that runs after the menu closed can still read it.
SystemBackdrop { get; set; } Gets or sets the material behind the menu; submenus opened from it follow. A menu in its own window gets the platform’s material, and a menu drawn inside its owner’s surface the same look from what that surface holds. Where neither can be shown, BackdropFallbackBrush is drawn under the background.
AddEntry(…) Adds an entry built beforehand after the existing items.
AddItem(…) Adds a command item that uses the command’s presentation. (4 methods)
AddSeparator() Adds a separator.
AddSubMenu(…) Adds a submenu item.
SetCommandTarget(…) Presets the command target snapshot the next Double}) resolves against. Use this for menus whose commands are bound to a standalone scope rather than the visual owner.
SetItems(…) Replaces the menu items.
Show(…) Opens the menu on the target as Placement directs. Pointer placement opens at the current pointer position. (2 methods)
static readonly ItemHeightProperty Gets or sets the height of menu items.
static readonly ItemPaddingProperty Gets or sets the padding around menu items.
static readonly MaxMenuHeightProperty
static readonly PlacementOffsetProperty
static readonly PlacementProperty
static readonly PlacementTargetProperty The element the last Show opened on.
static readonly SystemBackdropProperty