Skip to main content
A newer version of this page is available. .

RepositoryItemTokenEdit.BeforeShowMenu Event

Fires before this TokenEdit control’s popup menu is shown. Allows you to customize items within this menu.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v19.2.dll

Declaration

[DXCategory("Events")]
public event BeforeShowMenuEventHandler BeforeShowMenu

Event Data

The BeforeShowMenu event's data class is DevExpress.XtraEditors.Controls.BeforeShowMenuEventArgs.

Remarks

The BeforeShowMenu property allows you to customize the popup menu, shown when end-users right-click this Token Edit Control. Event arguments provide the following properties:

  • e.Items - menu item collection. You can add new DXMenuItem objects to this collection to create custom menu items.
  • e.Location - sets the menu display position.
  • e.RestoreMenu - gets or sets whether or not the menu should be reset to its default state after it has been displayed. By default, custom items added to the e.Items collection are not automatically removed when the menu is hidden. Set this property to true in order to reset the menu before each display.

The code snippet below illustrates an example.

void Properties_BeforeShowMenu(object sender, DevExpress.XtraEditors.Controls.BeforeShowMenuEventArgs e) {
    e.Menu.Items.Insert(1, new DXMenuItem() { Caption = "Custom Menu Item" });
    e.Location = new Point(100, 100);
    e.RestoreMenu = true;
}
See Also