#101410
admin
Keymaster

Hi Scott,
It is not possible to subscribe to ItemClicked event using Razor syntax, because it is not defined as a component Parameter and it cannot be as it is “event” type. It is possible to subscribe to the event using the syntax I sent you. ItemClicked way to subscribe to events is useful only when you want to add multiple event handlers.
For Example:

@page "/menu"
<Example Name="Menu">
<Menu OnReady="OnReady" OnItemClick="OnItemClick" id="menu">
<MenuItemsGroup>
File
<MenuItem Shortcut="Ctrl+N">New</MenuItem>
<MenuItem Shortcut="Ctrl+0">Open</MenuItem>
<MenuItemsGroup>
Open Containing Folder
<MenuItem>Explorer</MenuItem>
<MenuItem>cmd</MenuItem>
</MenuItemsGroup>
<MenuItem Shortcut="Ctrl+S" disabled>Save</MenuItem>
<MenuItem Shortcut="Ctrl+Alt+S" separator>Save As...</MenuItem>
<MenuItem Shortcut="Alt+F4">Exit</MenuItem>
</MenuItemsGroup>
<MenuItemsGroup>
Edit
<MenuItem Shortcut="Ctrl+Z">Undo</MenuItem>
<MenuItem Shortcut="Ctrl+Y" separator>Redo</MenuItem>
<MenuItem Shortcut="Ctrl+X">Cut</MenuItem>
<MenuItem Shortcut="Ctrl+C">Copy</MenuItem>
<MenuItem Shortcut="Ctrl+V" disabled>Paste</MenuItem>
</MenuItemsGroup>
<MenuItemsGroup DropDownHeight=300>
Encoding
<MenuItem>Encode in ANSI</MenuItem>
<MenuItem>Encode in UTF-8</MenuItem>
<MenuItem>Encode in UTF-8-BOM</MenuItem>
<MenuItem>Encode in UTCS-2 BE BOM</MenuItem>
<MenuItem>Encode in UTCS-2 LE BOM</MenuItem>
<MenuItemsGroup separator>
Character sets
<MenuItemsGroup>
Cyrillic
<MenuItem>ISO 8859-5</MenuItem>
<MenuItem>KOI8-R</MenuItem>
<MenuItem>KOI8-U</MenuItem>
<MenuItem>Windows-1251</MenuItem>
</MenuItemsGroup>
<MenuItemsGroup>
Chinese
<MenuItem>Big5 (Traditional)</MenuItem>
<MenuItem>GB2312 (Simplified)</MenuItem>
</MenuItemsGroup>
<MenuItemsGroup>
Western European
<MenuItem>ISO 8859-1</MenuItem>
<MenuItem>ISO 8859-15</MenuItem>
<MenuItem>OEM 850</MenuItem>
<MenuItem>Windows-1252</MenuItem>
</MenuItemsGroup>
</MenuItemsGroup>
<MenuItem>Convert to ANSI</MenuItem>
<MenuItem>Convert to UTF-8</MenuItem>
<MenuItem>Convert to UTF-8-BOM</MenuItem>
<MenuItem>Convert to UTCS-2 BE BOM</MenuItem>
<MenuItem>Convert to UTCS-2 LE BOM</MenuItem>
</MenuItemsGroup>
</Menu>
</Example>
@code {
void OnReady(Menu menu)
{
menu.ItemClicked += delegate(object sender, MenuItemClickedEventArgs args)
{
Console.WriteLine(args.Label);
};
}
void OnItemClick(Event eventObj)
{
MenuItemClickEventDetail detail = eventObj["Detail"];
Console.WriteLine(detail.Label);
}
}

Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/