Class MenuButton
- Namespace
- PluginUI
- Assembly
- PluginUI.dll
Button opening an arbitrary menu (MenuItem tree): settings, "more" menus, file menus. Handle Opening to rebuild the entries right before the menu appears.
public class MenuButton : Control
- Inheritance
-
MenuButton
- Inherited Members
Constructors
MenuButton()
Creates a menu button.
public MenuButton()
MenuButton(MenuButtonStyle, params MenuItem[])
Creates a menu button with entries.
public MenuButton(MenuButtonStyle look, params MenuItem[] items)
Parameters
lookMenuButtonStyleitemsMenuItem[]
Properties
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
IsMenuOpen
true while the menu is open.
public bool IsMenuOpen { get; }
Property Value
Items
Menu entries.
public IList<MenuItem> Items { get; set; }
Property Value
Look
Visual style.
public MenuButtonStyle Look { get; set; }
Property Value
MenuPlacement
Menu placement relative to the button.
public PopupPlacement MenuPlacement { get; set; }
Property Value
ShowBackground
Draws the raised box (otherwise flat until hovered).
public bool ShowBackground { get; set; }
Property Value
Text
Caption (text styles).
public string? Text { get; set; }
Property Value
Methods
OnKeyDown(KeyEventArgs)
Key pressed while focused (bubbles to parents).
protected override void OnKeyDown(KeyEventArgs e)
Parameters
OnMouseDown(MouseEventArgs)
Mouse button pressed over the element (or captured).
protected override void OnMouseDown(MouseEventArgs e)
Parameters
OpenMenu()
Opens the menu.
public void OpenMenu()
RenderVector(DrawingContext, Rect, VectorStyle)
Vector rendering of the widget area.
protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)
Parameters
dcDrawingContextwidgetRectstyleVectorStyle
Events
Opening
Raised before the menu opens (update Items here).
public event Action<MenuButton>? Opening