Back to Devexpress

BaseView.PopupMenuShowing Event

windowsforms-devexpress-dot-xtrabars-dot-docking2010-dot-views-dot-baseview.md

latest2.7 KB
Original Source

BaseView.PopupMenuShowing Event

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

Declaration

csharp
public event PopupMenuShowingEventHandler PopupMenuShowing
vb
Public Event PopupMenuShowing As PopupMenuShowingEventHandler

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.

csharp
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
}
vb
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

BaseView Class

BaseView Members

DevExpress.XtraBars.Docking2010.Views Namespace