PictureEdit.PopupMenuShowing Event
Fires when the context menu is about to be displayed.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Event Data
The PopupMenuShowing event's data class is DevExpress.XtraEditors.Events.PopupMenuShowingEventArgs.
Remarks
The Picture Editor fires the PopupMenuShowing
event when the context menu is about to be displayed and id the Properties.ShowMenu option is enabled. Handle the PopupMenuShowing
event to customize the context menu or to prevent the menu from being displayed.
The following table lists event parameters:
Property | Description |
---|---|
e.Point |
Allows you to obtain the position at which the editor is right-clicked. |
e.PopupMenu |
Allows you to access and customize the menu. The menu is represented by a DXPopupMenu object. |
e.RestoreMenu |
Allows you to specify whether to restore the context menu to the default settings after the menu has been displayed. |
e.Cancel |
Allows you you to prevent the menu from being displayed. |
The following example adds the “Properties” menu item to the Picture Editor’s context menu if the editor displays an image:
public Form1() {
InitializeComponent();
pictureEdit1.PopupMenuShowing += PictureEdit1_PopupMenuShowing;
}
void PictureEdit1_PopupMenuShowing(object sender, DevExpress.XtraEditors.Events.PopupMenuShowingEventArgs e) {
e.RestoreMenu = true;
if(pictureEdit1.EditValue != null)
e.PopupMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Properties",
new EventHandler(OnProperties_Click),
svgImageCollection1["properties"],
DevExpress.Utils.Menu.DXMenuItemPriority.Normal));
}
void OnProperties_Click(object sender, EventArgs e) {
// Do something when a user clicks the "Properties" item.
}
The image below shows the result:
The PopupMenuShowing
event is equivalent to the RepositoryItemPictureEdit.PopupMenuShowing event.