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

DxContextMenu.HideAsync() Method

Hides the Context Menu.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[JSInvokable]
public Task HideAsync()

Returns

Type Description
Task

The task that is completed when the context menu is hidden.

Remarks

Call this method to hide the Context Menu. To handle the situation when the Context Menu was hidden, use the Hidden event. To show the Context Menu, use the ShowAsync method.

<DxContextMenu @ref="@ContextMenu" ItemClick="@OnItemClick">
    <Items>
        <DxContextMenuItem Name="SortBy" Text="Sort By">
            <Items>
                <DxContextMenuItem Text="Name"></DxContextMenuItem>
                <DxContextMenuItem Text="Size"></DxContextMenuItem>
                <DxContextMenuItem Text="Type"></DxContextMenuItem>
            </Items>
        </DxContextMenuItem>
    </Items>
</DxContextMenu>

@code {
    DxContextMenu ContextMenu { get; set; }

    void OnItemClick(ContextMenuItemClickEventArgs args) {
        if(args.ItemInfo.Name == "SortBy") {
            ContextMenu.HideAsync();
        }
    }
}

Run Demo: Context Menu

See Also