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

RichEditControl.PreparePopupMenu Event

OBSOLETE

You should use the 'PopupMenuShowing' instead

Occurs before a context (popup) menu is created for the control’s document every time a context menu is being invoked.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v18.2.dll

Declaration

[Browsable(false)]
[Obsolete("You should use the 'PopupMenuShowing' instead", false)]
public event PreparePopupMenuEventHandler PreparePopupMenu

Event Data

The PreparePopupMenu event's data class is PreparePopupMenuEventArgs. The following properties provide information specific to this event:

Property Description
Menu Gets or sets the popup (context) menu for which this event was raised. Inherited from PopupMenuShowingEventArgs.
MenuType Gets a visual element for which the popup menu is invoked. Inherited from PopupMenuShowingEventArgs.

Remarks

Handle the PreparePopupMenu event to modify items in the context menu. The current context menu can be accessed via the PopupMenuShowingEventArgs.Menu property.

The following code snippet illustrates how you can add a custom menu command to the context menu.

using DevExpress.XtraRichEdit.API.Native;
// ...
private void richEditControl1_PopupMenuShowing(object sender, 
        DevExpress.XtraRichEdit.PopupMenuShowingEventArgs  e) {
    e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("MyMenu", 
        new EventHandler(mymenu_Click)));
}
void mymenu_Click(object sender, EventArgs e) {
    MessageBox.Show("test");
}
See Also