Log In
[Expand]Welcome to DevExpress .NET Documentation
[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
  [Collapse]Ribbon, Bars and Menu
   [Collapse]Popup Menus
    [Collapse]Popup Menus Customization
      Populating Popup Menus
      Showing Popup Menus
    Radial Menu
   [Expand]Common Features
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical 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]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Showing Popup Menus

Popup menus can be used in a number of ways. They can be displayed automatically as a result of end-user's actions, or you can implement your own logic and show popup menus manually. See below to learn more.


Before customizing and using a popup menu, add a BarManager or RibbonControl to the form and ensure that the popup menu is bound to this BarManager/RibbonControl. By default, a popup menu being added to the form at design time automatically looks for a BarManager/Ribbon Control within the form, and if it's found, binds itself to the located object via the PopupMenuBase.Manager/PopupMenuBase.Ribbon property. When creating the menu at runtime, you may need to manually bind it to a BarManager/Ribbon Control via these properties.

Expanded Automatic Display for Controls

It's possible to associate a popup menu with a control and automatically display this menu when an end-user right-clicks the control. To assign a menu to a control, use the control's external PopupContextMenu property. The external PopupContextMenu properties are added at design time for all controls within a form when you place a BarManager or RibbonControl component onto this form.

Add a popup menu to the form. Then, select a control and switch to the Properties window. Locate the external PopupContextMenu property and assign the popup menu to this property.

The menu assigned will be displayed at runtime when right-clicking within the control's bounds.

Note that the external PopupContextMenu property is available only at design time. To associate a menu with a control via code, you can use the BarManager.SetPopupContextMenu method. Call BarManager.GetPopupContextMenu to retrieve the control's popup menu.

Expanded Manual Display

To activate popup menus, you normally handle specific events. For instance, if you need to open a popup menu when an end-user right-clicks within a text box, you may want to handle the control's MouseUp event. To open a menu, call PopupMenu.ShowPopup.

Expanded Example

The following code displays a specific PopupMenu if the right mouse button is pressed:

Expanded Automatic Display for Bar Button Items

You can associate a dropdown control (including a PopupMenu object) with regular and large bar button items (BarButtonItem or BarLargeButtonItem). In this instance, this item displays a dropdown arrow and clicking this arrow shows the associated dropdown control below the item:

To associate a popup menu with a bar button item, use the BarButtonItem.DropDownControl property. In addition, the bar item's BarButtonItem.ButtonStyle property must be set to BarButtonStyle.DropDown.

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