Table of Contents

Class MenuPopup

Namespace
PluginUI
Assembly
PluginUI.dll

Custom-drawn popup menu with check marks, shortcuts, separators, sub-menus, keyboard navigation and scrolling. Usually shown through ShowMenu(IList<MenuItem>, Rect, PopupPlacement, float, Action?).

public class MenuPopup : Popup
Inheritance
MenuPopup
Inherited Members

Constructors

MenuPopup(IList<MenuItem>)

Creates a menu.

public MenuPopup(IList<MenuItem> items)

Parameters

items IList<MenuItem>

Properties

HighlightedIndex

Index of the highlighted entry (-1 = none).

public int HighlightedIndex { get; set; }

Property Value

int

Items

Entries.

public IList<MenuItem> Items { get; }

Property Value

IList<MenuItem>

ParentMenu

Menu that opened this sub-menu (null for a root menu).

public MenuPopup? ParentMenu { get; }

Property Value

MenuPopup

Methods

MeasureOverride(Size)

Natural size of the content for the available size (margins excluded).

protected override Size MeasureOverride(Size available)

Parameters

available Size

Returns

Size

OnKeyDown(KeyEventArgs)

Keyboard routed to the popup when CapturesKeyboard is set; Escape closes by default.

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

OnMouseDown(MouseEventArgs)

Mouse button pressed over the element (or captured).

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseLeave()

The mouse left the element.

protected override void OnMouseLeave()

OnMouseMove(MouseEventArgs)

Mouse moved over the element (or captured).

protected override void OnMouseMove(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseUp(MouseEventArgs)

Mouse button released.

protected override void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseWheel(MouseEventArgs)

Mouse wheel over the element.

protected override void OnMouseWheel(MouseEventArgs e)

Parameters

e MouseEventArgs

OnRender(DrawingContext)

Draws the element (below its children).

protected override void OnRender(DrawingContext dc)

Parameters

dc DrawingContext

Events

ItemChosen

Raised on the root menu when an entry is chosen.

public event Action<MenuPopup, MenuItem>? ItemChosen

Event Type

Action<MenuPopup, MenuItem>