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

Allows you to override the default commands.

Namespace: DevExpress.Diagram.Core

Assembly: DevExpress.Diagram.v20.2.Core.dll

Declaration

public ICommandHandlers RegisterHandlers(
    Action<IHandlersRegistrator> registerHandlers,
    bool updateCommandsOnRequerySuggested = false
)
Public Function RegisterHandlers(
    registerHandlers As Action(Of IHandlersRegistrator),
    updateCommandsOnRequerySuggested As Boolean = False
) As ICommandHandlers

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