Overview

RIGHT-CLICK OR LONG PRESS TO SHOW THE CONTEXT MENU

Clicked item: None

The Context Menu component allows you to add a context menu to your Blazor application. To invoke the context menu at runtime, users can right-click (on mouse-equipped devices) or long press (on touch-enabled devices, except for iOS the area where they want to display the context menu. To display the context menu in code, call the ShowAsync method.

This demo illustrates how to add the Context Menu component to an application.

Data Binding

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sit amet metus vel nisi blandit tincidunt vel efficitur purus. Nunc nec turpis tempus, accumsan orci auctor, imperdiet mauris. Fusce id purus magna.

You can bind the Context Menu to hierarchical data structures to populate menu items. Follow the steps below:

  1. Use the Context Menu's Data property to specify a data source.
  2. Add the <DataMappings> tag to the component markup.
  3. In the <DataMappings> tags, create the DxContextMenuDataMapping instance and map item properties to data source fields. Mappings are used to adjust the Context Menu's data model to the data source. For hierarchical data, the Children property is required.