Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Expand]Views
  [Collapse]List Editors
    How to: Configure Bands in a Grid List Editor (WinForms and ASP.NET)
    How to: Edit a Reference Property in the Batch Edit Mode
    How to: Implement a Custom WinForms List Editor
    How to: Implement an ASP.NET Web List Editor Using a Custom Control
    How to: Support a Context Menu for a Custom WinForms List Editor
  [Expand]Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Support a Context Menu for a Custom WinForms List Editor

In XAF applications, List Views can have context menus filled with Actions. For this purpose, the List Editor displaying a List View should support the IRequireContextMenu and IRequireDXMenuManager interfaces. This topic describes how to implement these interfaces in the WinCustomListEditor demonstrated in the How to: Implement a Custom WinForms List Editor topic.

The following image illustrates the context menu invoked for the WinCustomListEditor.

Note

You can see the code implemented here in the FeatureCenter demo installed with XAF. This demo is located in the %PUBLIC%\Documents\DevExpress Demos 17.2\Components\eXpressApp Framework\FeatureCenter folder by default.

To enable the context menu in a custom List Editor, modify its code in the following manner.

If you implement a List Editor using a descendant of the EditorContainer control, initialize the EditorContainer.MenuManager property in the SetMenuManager method.

In the QueryShowPopupMenu event handler, you can specify whether or not to cancel showing the context menu for the current region of the control using the e.Cancel parameter. For instance, you can use the following logic for the GridView control.

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