MenuStrip
Description
This component represents a menu strip in Blazor using the Gap.Blazor.MenuStrip
model. It renders a hierarchical menu using the Telerik Menu
component and dynamically builds the menu structure from a ToolStripItemCollection
. It supports nested submenus and click event handling for each item.
Usage
Properties
menuStrip: Instance of the
Gap.Blazor.MenuStrip
model.menuItems: A list of
MenuItem
objects representing the menu hierarchy.
MenuItem Class
Methods
OnInitialized(): Subscribes to the
Click
event and builds the menu structure from the model.buildMenuList(ToolStripItemCollection): Recursively constructs the top-level menu items.
buildMenuItem(ToolStripItem): Converts a
ToolStripItem
into aMenuItem
, including subitems if present.buildSubItems(ToolStripItemCollection): Recursively builds nested submenus.
OnClickHandler(MenuItem): Executes the
PerformClick()
method on the associatedToolStripItem
.GetBackColorHex(): Returns the background color in hex format, defaulting to
#FDFDFDFF
if not set.
Dynamic Rendering
TelerikMenu: Renders the menu UI with support for nested items.
Dynamic Styling: Background and text colors are derived from the model.
Submenus: Automatically rendered based on the
SubItems
property.
Styles
Events
Click: Triggered when a menu item is clicked, invoking the associated
ToolStripItem.PerformClick()
.
Last updated