Skip to main content

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

NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.RichEdit, DevExpress.Win.TreeMap

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