windowsforms-devexpress-dot-xtrabars-dot-docking2010-dot-views-dot-baseview.md
Fires when a context menu is about to be displayed.
Namespace : DevExpress.XtraBars.Docking2010.Views
Assembly : DevExpress.XtraBars.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public event PopupMenuShowingEventHandler PopupMenuShowing
Public Event PopupMenuShowing As PopupMenuShowingEventHandler
The PopupMenuShowing event's data class is DevExpress.XtraBars.Docking2010.Views.PopupMenuShowingEventArgs.
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
}
Private Sub tabbedView1_PopupMenuShowing(sender As Object, e As DevExpress.XtraBars.Docking2010.Views.PopupMenuShowingEventArgs)
e.Menu.Items.Add(New DXMenuItem("My Item", customItemClick))
End Sub
Private Sub customItemClick(sender As Object, e As EventArgs)
'do something
End Sub
See the GridView.PopupMenuShowing event description for examples.
See Also