Search results

Open Sub Menu on Context Menu Item Click in Blazor ContextMenu component

03 Aug 2021 / 1 minute to read

This section explains about how to open a sub menu on Context Menu item click. This can be achieved by using ShowItemOnClick property of the Context Menu.

In the following sample, Sub Menu will open while clicking Save item.

Copied to clipboard
@using Syncfusion.Blazor.Navigations

<div id="target">Right click/Touch hold to open the ContextMenu </div>
<SfContextMenu Target="#target" TValue="MenuItem" ShowItemOnClick="true">
        <MenuItem Text="Back"></MenuItem>
        <MenuItem Text="Forward"></MenuItem>
        <MenuItem Text="Reload"></MenuItem>
        <MenuItem Separator="true"></MenuItem>
        <MenuItem Text="Save">
                <MenuItem Text="Save"></MenuItem>
                <MenuItem Text="Save As..."></MenuItem>
        <MenuItem Text="Print"></MenuItem>
        <MenuItem Text="Cast"></MenuItem>

    #target {
        border: 1px dashed;
        height: 150px;
        padding: 10px;
        position: relative;
        text-align: justify;
        color: gray;
        user-select: none;