Skip to main content
A newer version of this page is available. .

DxContextMenu.ShowAsync(Double, Double) Method

Displays the Context Menu at the specified location.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public Task ShowAsync(
    double x,
    double y
)

Parameters

Name Type Description
x Double

Specifies the location’s X coordinate.

y Double

Specifies the location’s Y coordinate.

Returns

Type Description
Task

An asynchronous operation that displays the Context Menu.

Remarks

Call this method to show the Context Menu at the specified coordinates on a browser window (x,y). To specify the code that should be executed when the Context Menu is displayed, handle the Shown event.

Note

To show the Context Menu at a mouse event’s coordinates (for example, the user’s right-click position), use the ShowAsync(MouseEventArgs) method. To hide a Context Menu, call the HideAsync() method.

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

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

Run Demo: Context Menu

See Also