DxContextMenu.SubMenuTemplate Property
Specifies the template for submenus of all context menu items.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public RenderFragment<IContextMenuItemInfo> SubMenuTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment<IContextMenuItemInfo> | The template content. |
Remarks
The Context Menu component allows you to define templates for the layout and appearance of menu items and their elements. For more information on templates for context menu items, refer to the following section: Context Menu - Item Templates.
Use the SubMenuTemplate
property to specify a common template for submenus of all menu items.
<div class="target-container" @oncontextmenu="((e) => ContextMenu.ShowAsync(e))" @oncontextmenu:preventDefault>
<p class="target-caption">RIGHT-CLICK OR LONG PRESS TO SHOW THE CONTEXT MENU</p>
</div>
<DxContextMenu @ref="@ContextMenu">
<SubMenuTemplate>
The @context.Text item's submenu!
</SubMenuTemplate>
<Items>
<DxContextMenuItem Text="Home" IconCssClass="oi oi-home" />
<DxContextMenuItem Text="Contacts" IconCssClass="oi oi-phone" />
<DxContextMenuItem Text="Calendar" IconCssClass="oi oi-calendar" />
<DxContextMenuItem Text="About" IconCssClass="oi oi-question-mark" BeginGroup="true" />
</Items>
</DxContextMenu>
@code {
DxContextMenu ContextMenu { get; set; }
}
To override a submenu template for an individual menu item, use the DxContextMenuItem.SubMenuTemplate property.
See Also