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

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.2.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