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

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

NuGet Package: DevExpress.Win.RichEdit

#Declaration

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

#Event Data

The PreparePopupMenu event's data class is DevExpress.XtraRichEdit.PreparePopupMenuEventArgs.

#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