Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started With Data Grid and Views
   [Expand]Data Binding
    Unbound Columns
   [Expand]Data Editing and Validation
   [Expand]Filter and Search
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Collapse]Popup Menus
     Popup Menus Overview
     Creating Custom Context Menus
     Implementing Custom Behavior for Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Implementing Custom Behavior for Popup Menus

This topic provides information about customization of popup menus. The base concepts for popup menus are described in the Popup Menus Overview topic.

Expanded Implementing Custom Behavior for Popup Menus

Basically, you can allow or prohibit the display of context menus by using the GridView.OptionsMenu property. For greater control over context menus, you can use the GridView.PopupMenuShowing event. If the GridView.OptionsMenu property allows menu invoking, the GridView.PopupMenuShowing event fires each time a user attempts to invoke a context menu.

Let's consider the event GridView.PopupMenuShowing in detail. The data for this event is provided by the GridMenuEventArgs class. The event's parameters enable you to identify the menu to be displayed, customize the menu or to stop it from being invoked.

The following example handles the GridView.PopupMenuShowing event to create a custom column header context menu. The event's Menu parameter is used to access the current menu. The full code can be found in the Fixed Columns demo.

Additionally, you can stop a menu from being invoked via the event's Allow parameter. The Point parameter gets or sets the context menu location.

The GridView.GridMenuItemClick event is fired in response to clicking a menu item. It enables you to cancel the default actions performed when clicking a particular item and/or provide your own item handling. The following example handles the GridView.GridMenuItemClick event to change the summary format in the Sub Total column. This is needed since default formatting is applied to summaries when one is changing their type using the context menu. Thus, the event handler below changes the format string applied to display values using the currency format.

The GridMenuItemClickEventArgs.MenuType and GridMenuItemClickEventArgs.DXMenuItem parameters are used to determine the menu item clicked . The GridMenuItemClickEventArgs.SummaryFormat parameter represents the current summary format.

Expanded See Also

Is this topic helpful?​​​​​​​