[]
        
(Showing Draft Content)

ICommand Interface

The ICommand interface, located in the System.Windows.Input namespace, defines the standard contract for actions that can be executed from the UI. ComponentOne controls that support command binding utilize this standard interface.

  • CanExecute: Determines whether the command is currently available for execution. If this method returns false, bound controls are automatically disabled.

bool CanExecute(object parameter);

Example: A “Save” command may only be executable if unsaved changes exist.

  • Execute: Defines the actual logic to perform when the command is executed.

void Execute(object parameter);

Example: A “Delete” command might remove a selected record from a data source.

  • CanExecuteChanged: An event raised whenever the execution state of the command changes. The UI listens for this event to automatically update control states (enabled/disabled).

event EventHandler CanExecuteChanged;

For more information about ICommand Interface, visit: ICommand Interface (System.Windows.Input) | Microsoft Learn