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 (mouse-equipped devices) or long press (touch-enabled devices) 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.

Bind to Hierarchical Data

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.

The Context Menu can be bound to hierarchical data structures. Specify the following properties to bind the component to a hierarchical data structure:

  • Data - A Context Menu data source object.
  • ChildrenExpression - A lambda expression that returns the data item’s children.

The following properties specify expressions that return menu item information (text, name, and so on):

  • NameExpression - A lambda expression that returns a menu item’s unique identifier (name).
  • ClickExpression - A lambda expression that returns a handler for a menu item’s Click event.
  • TextExpression - A lambda expression that returns a menu item’s text.
  • IconUrlExpression - A lambda expression that returns the URL of a menu item icon.
  • BeginGroupExpression - A lambda expression that specifies the start of an item group.