Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Summaries
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Hints
   [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]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [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]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[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

How would you rate this topic?​​​​​​​