Skip to main content
All docs
V20.2

DxContextMenu.Show(MouseEventArgs) Method

Displays the Context Menu according to a mouse event’s coordinates.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public Task Show(
    MouseEventArgs e
)

Parameters

Name Type Description
e MouseEventArgs

The Blazor’s built-in MouseEventArgs event arguments.

Returns

Type Description
Task

An asynchronous operation that displays the Context Menu.

Remarks

Call this method to show the Context Menu at a mouse event’s coordinates (for example, the user’s right-click position). To specify the code that should be executed when the Context Menu is displayed, handle the Shown event.

Note

To display the Context Menu at the specified location (x,y), use the Show(Double, Double) method. To hide a Context Menu, call the Hide() method.

<div style="height: 200px;"  
     @oncontextmenu="((e) => ContextMenu.Show(e))" 
     @oncontextmenu:preventDefault>
    <span style="font-weight: 600">RIGHT-CLICK TO SHOW THE CONTEXT MENU</span>
</div>

<DxContextMenu @ref="@ContextMenu">
    <Items>
        <DxContextMenuItem Text="Copy"></DxContextMenuItem>
        <DxContextMenuItem Text="Cut"></DxContextMenuItem>
        <DxContextMenuItem Text="Remove"></DxContextMenuItem>
    </Items>
</DxContextMenu>

Run Demo: Context Menu

See Also