Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BaseView.PopupMenuShowing Event

Fires when a context menu is about to be displayed.

Namespace: DevExpress.XtraBars.Docking2010.Views

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

public event PopupMenuShowingEventHandler PopupMenuShowing

#Event Data

The PopupMenuShowing event's data class is DevExpress.XtraBars.Docking2010.Views.PopupMenuShowingEventArgs.

#Remarks

You can handle this event to add custom menu items to a context menu or to prevent the menu from being displayed.

The event’s Menu parameter specifies the menu to be displayed. You can add custom items to this menu or remove existing items, if required. The event’s HitInfo object allows you to identify the View’s clicked element for which the menu should be displayed.

To cancel the menu display, set the event’s Cancel parameter to true.

Use the Menu.Items collection to add or remove menu items. The code below illustrates how to add a custom DXMenuItem to the context menu within a TabbedView.

private void tabbedView1_PopupMenuShowing(object sender, DevExpress.XtraBars.Docking2010.Views.PopupMenuShowingEventArgs e) {
    e.Menu.Items.Add(new DXMenuItem("My Item", customItemClick));
}

private void customItemClick(object sender, EventArgs e) {
    //do something
}

See the GridView.PopupMenuShowing event description for examples.

See Also