# FerroCreatesCommandBinding

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui-controls/struct-ferrocreatescommandbinding/

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

```rust
struct FerroCreatesCommandBinding
```

Binds commands to the input elements of FerroUI, through a command source's `Command` property
or through a routed event (`FerroCreatesCommandBinding`).

A control that is a command source, such as a button or a menu item, is bound through its
`Command` and `CommandParameter` properties (the ones `Button` registers and every button-like
control and menu item shares). Any other input element is bound through a routed event that
executes the command and keeps `IsEnabled` in step with `can_execute`.

The control is given as an `Rc<dyn Any>` holding its handle (`Ref<T>`), and its type as the
`TypeId` of that handle; `FerroObjectHandles::object_of` lists the other forms.

Deviation (DEVIATIONS.md, ReactiveUI controls): the command of ReactiveUI is set on the control
through a [`ReactiveCommandAdapter`](/docs/0.5.0/api/ferroui-reactiveui-controls/struct-reactivecommandadapter/), and the parameters through
`boxed_parameter`. A type is a command source when its class
registers the `Command` property of buttons (an instance: when it is an `ICommandSource` with
that property), as `is ICommandSource` cannot be asked of a type. The event binding has no type
of event arguments to match (the trait of the port has no `TEventArgs`), so the event is found
by its name alone.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/ferro_creates_command_binding.rs#L37)

## Members

- [`EVENT_TARGET_AFFINITY`](#assoc_const-event_target_affinity)
- [`COMMAND_SOURCE_AFFINITY`](#assoc_const-command_source_affinity)
- [`new`](#function-new)

<a id="assoc_const-event_target_affinity"></a>

### EVENT_TARGET_AFFINITY

```rust
const EVENT_TARGET_AFFINITY: i32
```

The affinity of a binding through a named routed event (`EventTargetAffinity`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/ferro_creates_command_binding.rs#L41)

<a id="assoc_const-command_source_affinity"></a>

### COMMAND_SOURCE_AFFINITY

```rust
const COMMAND_SOURCE_AFFINITY: i32
```

The affinity of a binding through a command source's `Command` property
(`CommandSourceAffinity`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/ferro_creates_command_binding.rs#L45)

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

### new

```rust
fn new() -> Self
```

The binder (`new FerroCreatesCommandBinding()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/ferro_creates_command_binding.rs#L48)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Debug`
- `Default`
- `Clone`
- `Copy`
- [`ICreatesCommandBinding`](/docs/0.5.0/api/ferroui-reactiveui/binding/interfaces/trait-icreatescommandbinding/)

## Availability

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