DxContextMenuItem.Template Property
Specifies the context menu item’s template.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public RenderFragment<IContextMenuItemInfo> Template { 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.
The DxContextMenu.ItemTemplate property specifies the common template for all menu items. The DxContextMenuItem.Template
property overrides the common template for the current menu item.
<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">
<ItemTemplate>
<b>@context.Text</b> is bold!
</ItemTemplate>
<Items>
<DxContextMenuItem Text="Home" />
<DxContextMenuItem Text="Contacts" />
<DxContextMenuItem Text="Calendar" />
<DxContextMenuItem Text="About" BeginGroup="true">
<Template>
<i>@context.Text</i> is italic!
</Template>
</DxContextMenuItem>
</Items>
</DxContextMenu>
@code {
DxContextMenu ContextMenu { get; set; }
}
See Also