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

DiagramCommandsBase.RegisterHandlers(Action<IHandlersRegistrator>, Boolean) Method

Allows you to override the default commands.

Namespace: DevExpress.Diagram.Core

Assembly: DevExpress.Diagram.v19.1.Core.dll

Declaration

public ICommandHandlers RegisterHandlers(
    Action<IHandlersRegistrator> registerHandlers,
    bool updateCommandsOnRequerySuggested = false
)

Parameters

Name Type Description
registerHandlers Action<DevExpress.Diagram.Core.IHandlersRegistrator>

An action delegate that registers a custom method to be called when executing the specified command.

Optional Parameters

Name Type Default Description
updateCommandsOnRequerySuggested Boolean False

true, to update the commands UI after each diagram action; otherwise, false. By default, false.

Returns

Type Description
DevExpress.Diagram.Core.ICommandHandlers

A collection of custom command handlers.

Remarks

The example below illustrates how to disable the standard DiagramCommandsBase.CopyCommand.


diagram.Commands.RegisterHandlers(x => x.RegisterHandlerCore(DevExpress.Xpf.Diagram.DiagramCommands.CopyCommand,
                (param, diagram, getArgs, baseHandler) => { }, (param, diagram, baseCanExecute) => false));

The following example illustrates how to modify this command.


diagram.Commands.RegisterHandlers(x => x.RegisterHandlerCore(DevExpress.Xpf.Diagram.DiagramCommands.CopyCommand,
                (param, diagram, getArgs, baseHandler) => { baseHandler(); MessageBox.Show("Items copied"); }, (param, diagram, baseCanExecute) => baseCanExecute()));
See Also