ContextMenuItem - Add separator item type #1013

Closed
opened 2026-01-29 17:47:46 +00:00 by claunia · 2 comments
Owner

Originally created by @RemiCELLARD on GitHub (Oct 18, 2023).

Is your feature request related to a problem? Please describe.
I'm always frustrated when you have to use RenderFragment instead of ContextMenuItem class to create a separator in ContextMenu (example : for DataGrid Cell)

Describe the solution you'd like

  • Add in class ContextMenuItem a new getter/setter (boolean) IsSeparator
  • When you render this, add separator <hr/> in your ContextMenu.

Describe alternatives you've considered
You can use RenderFragment (see https://blazor.radzen.com/docs/api/Radzen.ContextMenuOptions.html#Radzen_ContextMenuOptions_ChildContent ) but for my case, it's better to use object.

Additional context
No more element

Originally created by @RemiCELLARD on GitHub (Oct 18, 2023). **Is your feature request related to a problem? Please describe.** I'm always frustrated when you have to use RenderFragment instead of `ContextMenuItem` class to create a separator in ContextMenu (example : for DataGrid Cell) **Describe the solution you'd like** - Add in class `ContextMenuItem` a new getter/setter (boolean) `IsSeparator` - When you render this, add separator `<hr/>` in your ContextMenu. **Describe alternatives you've considered** You can use RenderFragment (see https://blazor.radzen.com/docs/api/Radzen.ContextMenuOptions.html#Radzen_ContextMenuOptions_ChildContent ) but for my case, it's better to use object. **Additional context** No more element
Author
Owner

@enchev commented on GitHub (Oct 24, 2023):

You can already place any custom content for the context menu including RadzenMenuItem and a plain hr HTML element:
image
image
https://blazor.radzen.com/contextmenu

@enchev commented on GitHub (Oct 24, 2023): You can already place any custom content for the context menu including RadzenMenuItem and a plain `hr` HTML element: ![image](https://github.com/radzenhq/radzen-blazor/assets/5804953/2d9d333d-6685-4ac0-832a-c2e79f00dd0a) ![image](https://github.com/radzenhq/radzen-blazor/assets/5804953/8acb57a9-99d2-4348-9d2e-0289501fde14) https://blazor.radzen.com/contextmenu
Author
Owner

@dave-gcv commented on GitHub (Jul 19, 2024):

Trying to understand why this was closed/not considered ?

Like the OP, I am also looking for an "easy" programatic way to add a separator to the context menu.

Having to use the RenderFragment way just isn't convenient enough, is prone to error and inefficient especially if you have a large number of items in the menu or the items that appear in the menu are dynamic based on various factors.

Having the "IsSeparator" flag or even support for Class property (applied to the li element) just seems logical ?

@dave-gcv commented on GitHub (Jul 19, 2024): Trying to understand why this was closed/not considered ? Like the OP, I am also looking for an "easy" programatic way to add a separator to the context menu. Having to use the RenderFragment way just isn't convenient enough, is prone to error and inefficient especially if you have a large number of items in the menu or the items that appear in the menu are dynamic based on various factors. Having the "IsSeparator" flag or even support for Class property (applied to the **li** element) just seems logical ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1013