ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Framework Namespace / RelayCommand Class
Members

In This Topic
    RelayCommand Class
    In This Topic
    An implementation of ICommand.
    Syntax
    Remarks

    RelayCommands are helpful in decoupling the user interface from the logic that needs to run when a button is clicked for example.

    The framework's RelayCommand implementation is special in that by default it will add the command to the application's main message pump meaning its CanExecute function will automatically be called several times a second. If you do not need this behavior, set supportsOnUpdate to false in the appropriate constructor. If you do use this behavior, make sure you Disconnect the command from the pump when your dialog closes.

    RelayCommands automatically disable whenever the primary worker thread is busy. To override this behavior set disableWhenBusy to false in the appropriate constructor.

    Note, RelayCommands in the message pump automatically disable once the application begins to shutdown.

    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Framework.RelayCommand

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also