Skip to main content

ToolboxControl.InitializeMenu Event

Fires when the ToolboxControl popup menu is about to be shown, and allows you to customize the menu.

Namespace: DevExpress.XtraToolbox

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Events")]
public event ToolboxInitializeMenuEventHandler InitializeMenu

Event Data

The InitializeMenu event's data class is DevExpress.XtraToolbox.ToolboxInitializeMenuEventArgs.

Remarks

The ToolboxControl can display the menu button that invokes the pop-up menu providing quick access to the groups of items. To specify whether the menu button is shown, use the ToolboxOptionsView.ShowMenuButton property. It is also possible to display custom commands in the menu by handling the InitializeMenu event.

The InitializeMenu event is fired before the ToolboxControl pop-up menu is shown. The ToolboxInitializeMenuEventArgs.Menu property returns the DXPopupMenu object that represents the pop-up menu that is about to be displayed.

The code snippet below shows how to add a custom command to the menu.

private void toolboxControl_InitializeMenu(object sender, ToolboxInitializeMenuEventArgs e) {
    e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Close", (o, args) => this.Close()));
}
See Also