I have a blazor context menu that I'm triggering with an onclick actions:
Context Menu;
<SfContextMenu @ref="ContextMenuFromButton" Target="#OrdersViewContextMenu" TValue="MenuItem" Items="MenuItemsFromButton">
<MenuEvents TValue="MenuItem" ItemSelected="ContextMenuItemClickedFromButton"></MenuEvents>
</SfContextMenu>
Button;
<button id="OrdersViewContextMenu" class="btn btn-sm btn-secondary" @onclick="((args) => ContextMenuOpenFromButton(args, _order.parentId))">
<em class="fa fa-ellipsis-h"></em>
</button>
And my Action;
public async Task ContextMenuOpenFromButton(MouseEventArgs e, Guid id)
{
try
{
await ContextMenuOpenHandler(id); // Sets the Context Menu Items
ContextMenuFromButton.Open(e.ClientX, e.ClientY);
StateHasChanged(); // Needs to be before Grid Refresh
}
catch (Exception ex)
{
var x = ex;
}
}
However, the Context Menu doesn't open, giving a System.ObjectDisposedException for the ScopedServices of the Context Menu (See Image). How do I get the Contest Menu to Open?
Attachment: 20220324_141652_858396ae.zip