# ICommand

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/reactive_command/trait-icommand/

**trait** · [`ferroui-reactiveui`](/docs/0.5.0/api/ferroui-reactiveui/) · v0.5.0

```rust
trait ICommand
```

A command, executed with a parameter of any type (`System.Windows.Input.ICommand`).

Deviation (DEVIATIONS.md, ReactiveUI): the parameter `object?` is `Option<&dyn Any>`, and the
event `CanExecuteChanged` is `can_execute_changed`, which adds a
handler and returns the disposable that removes it.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/reactive_command/i_command.rs#L16)

## Members

- [`can_execute`](#function-can_execute)
- [`execute`](#function-execute)
- [`can_execute_changed`](#function-can_execute_changed)

<a id="function-can_execute"></a>

### can_execute

```rust
fn can_execute(self: &Self, parameter: Option<&dyn Any>) -> bool
```

Whether the command can execute with `parameter` now (`CanExecute(object?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/reactive_command/i_command.rs#L18)

<a id="function-execute"></a>

### execute

```rust
fn execute(self: &Self, parameter: Option<&dyn Any>)
```

Executes the command with `parameter` (`Execute(object?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/reactive_command/i_command.rs#L21)

<a id="function-can_execute_changed"></a>

### can_execute_changed

```rust
fn can_execute_changed(self: &Self, handler: Rc<dyn Fn() -> ()>) -> Rc<dyn IDisposable>
```

Adds `handler`, which runs when what `can_execute` answers may have
changed (`CanExecuteChanged`); disposing the result removes it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/reactive_command/i_command.rs#L25)

## Trait implementations

- [`ICommand`](/docs/0.5.0/api/ferroui-base/data/model/trait-icommand/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
