Skip to main content
All docs
V25.1
  • ImageEditToEditModeBehavior.CustomEditMenuItems Event

    Allows you to change items displayed in the ImageEdit edit menu.

    Namespace: DevExpress.Xpf.Editors

    Assembly: DevExpress.Xpf.Core.v25.1.dll

    NuGet Package: DevExpress.Wpf.Core

    Declaration

    public event EventHandler<CustomEditMenuItemsEventArgs> CustomEditMenuItems

    Event Data

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

    Property Description
    EditMenuItems Gets or sets a collection of items displayed in the ImageEdit edit menu.

    Remarks

    The CustomEditMenuItems event occurs when the editor is displayed (if ShowMenuMode is set to Always) or each time the edit menu is shown (if ShowMenuMode is set to Hover). This event allows you to add and remove buttons.

    The following code sample removes zoom-related buttons (Zoom In and Zoom Out) and adds confirmation buttons (OK and Cancel):

    ImageEdit EditMode - Customize Buttons

    void editBehavior_CustomEditMenuItems(object sender, DevExpress.Xpf.Editors.CustomEditMenuItemsEventArgs e) {
    
        // Remove Zoom buttons:
        var items = ((ImageEditToEditModeBehavior)sender).EditMenuItems;
        foreach (var item in items) {
            if (item is ImageEditToolButtonInfo button 
                && button.Command == ((ImageEditToEditModeBehavior)sender).ZoomCommand)
                e.EditMenuItems.Remove(item);
        }
    
        // Add OK and Cancel buttons:
        e.EditMenuItems.Add(new ImageEditToolSeparatorInfo());
        e.EditMenuItems.Add(new ImageEditToolButtonInfo() {
            Glyph = ImageEditToolButtonHelper.ImageIdToImageSource("ok"),
            ToolTip = "OK",
            Command = new DelegateCommand(Confirm)
        });
        e.EditMenuItems.Add(new ImageEditToolButtonInfo() {
            Glyph = ImageEditToolButtonHelper.ImageIdToImageSource("cancel"),
            ToolTip = "Cancel",
            Command = new DelegateCommand(Close)
        });
    }
    

    The CustomEditMenuItems event does not allow you to change items defined through the MenuTemplate property.

    See Also