# ExecuteCommandBehaviorBase

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-interactions-custom/struct-executecommandbehaviorbase/

**struct** · [`ferroui-xaml-interactions-custom`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/) · v0.5.0

```rust
struct ExecuteCommandBehaviorBase
```

The base class of the behaviors that execute a command (the `ExecuteCommandOn*Behavior`
classes): the command, its parameter, whether it can execute, and the element to focus when it
runs.

The class is abstract: a deriving class implements
`AttachedToVisualTreeBehaviorImpl::on_attached_to_visual_tree_override` to listen for its
event while the control is in the visual tree, and calls
`execute_command` when it fires.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L28)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`execute_command`](#function-execute_command)
- [`top_level_property`](#function-top_level_property)
- [`command_property`](#function-command_property)
- [`can_execute_command_property`](#function-can_execute_command_property)
- [`command_parameter_property`](#function-command_parameter_property)
- [`focus_top_level_property`](#function-focus_top_level_property)
- [`focus_control_property`](#function-focus_control_property)
- [`source_control_property`](#function-source_control_property)
- [`construct`](#function-construct)
- [`top_level`](#function-top_level)
- [`set_top_level`](#function-set_top_level)
- [`command`](#function-command)
- [`set_command`](#function-set_command)
- [`can_execute_command`](#function-can_execute_command)
- [`command_parameter`](#function-command_parameter)
- [`set_command_parameter`](#function-set_command_parameter)
- [`focus_top_level`](#function-focus_top_level)
- [`set_focus_top_level`](#function-set_focus_top_level)
- [`focus_control`](#function-focus_control)
- [`set_focus_control`](#function-set_focus_control)
- [`source_control`](#function-source_control)
- [`set_source_control`](#function-set_source_control)

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

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L34)

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<ExecuteCommandBehaviorBase>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L34)

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

### execute_command

```rust
fn execute_command(self: &Self) -> bool
```

Executes the associated command.

Returns true if the command was executed; otherwise, false.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L34)

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

### top_level_property

```rust
fn top_level_property() -> &'static StyledProperty<Option<ElementRef<TopLevel>>>
```

Identifies the `TopLevel` property.

Deviation (DEVIATIONS.md, Behaviors): the behavior does not own the top level, so the
value is an element reference.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L109)

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

### command_property

```rust
fn command_property() -> &'static StyledProperty<Option<Rc<dyn ICommand>>>
```

Identifies the `Command` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L109)

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

### can_execute_command_property

```rust
fn can_execute_command_property() -> &'static DirectProperty<ExecuteCommandBehaviorBase, bool>
```

Identifies the `CanExecuteCommand` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L109)

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

### command_parameter_property

```rust
fn command_parameter_property() -> &'static StyledProperty<Option<BoxedValue>>
```

Identifies the `CommandParameter` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L109)

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

### focus_top_level_property

```rust
fn focus_top_level_property() -> &'static StyledProperty<bool>
```

Identifies the `FocusTopLevel` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L109)

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

### focus_control_property

```rust
fn focus_control_property() -> &'static StyledProperty<Option<ElementRef<Control>>>
```

Identifies the `FocusControl` property.

Deviation (DEVIATIONS.md, Behaviors): the reference registers this property under the
name `CommandParameter` (`nameof(CommandParameter)`), a second property of that name;
here it is registered as `FocusControl` (defect corrected). The behavior does not own
the control, so the value is an element reference.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L109)

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

### source_control_property

```rust
fn source_control_property() -> &'static StyledProperty<Option<ElementRef<Control>>>
```

Identifies the `SourceControl` property.

Deviation (DEVIATIONS.md, Behaviors): the behavior does not own the control, so the
value is an element reference.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L109)

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

### construct

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

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L218)

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

### top_level

```rust
fn top_level(self: &Self) -> Option<Ref<TopLevel>>
```

Gets or sets the top level to focus when `focus_top_level` is
set; when it is null, the root of the logical tree of the associated control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L228)

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

### set_top_level

```rust
fn set_top_level(self: &Self, value: impl Into<Nullable<TopLevel>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L232)

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

### command

```rust
fn command(self: &Self) -> Option<Rc<dyn ICommand>>
```

Gets or sets the command to execute.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L237)

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

### set_command

```rust
fn set_command(self: &Self, value: Option<Rc<dyn ICommand>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L241)

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

### can_execute_command

```rust
fn can_execute_command(self: &Self) -> bool
```

Gets a value indicating whether `command` can execute with the current
`command_parameter`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L247)

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

### command_parameter

```rust
fn command_parameter(self: &Self) -> Option<BoxedValue>
```

Gets or sets the parameter of the command.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L256)

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

### set_command_parameter

```rust
fn set_command_parameter(self: &Self, value: Option<BoxedValue>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L260)

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

### focus_top_level

```rust
fn focus_top_level(self: &Self) -> bool
```

Gets or sets a value indicating whether the top level is focused when the command runs.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L265)

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

### set_focus_top_level

```rust
fn set_focus_top_level(self: &Self, value: bool)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L269)

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

### focus_control

```rust
fn focus_control(self: &Self) -> Option<Ref<Control>>
```

Gets or sets the control focused when the command runs. Markup resolves a name given for
it to the named element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L275)

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

### set_focus_control

```rust
fn set_focus_control(self: &Self, value: impl Into<Nullable<Control>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L279)

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

### source_control

```rust
fn source_control(self: &Self) -> Option<Ref<Control>>
```

Gets or sets the control whose event the behavior listens for; when it is null, the
associated control. Markup resolves a name given for it to the named element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L285)

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

### set_source_control

```rust
fn set_source_control(self: &Self, value: impl Into<Nullable<Control>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/execute_command/core/execute_command_behavior_base.rs#L289)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`AttachedToVisualTreeBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-attachedtovisualtreebehaviorimplext/)
- [`ExecuteCommandBehaviorBaseImplExt`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-executecommandbehaviorbaseimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`DisposingBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-disposingbehaviorimplext/)
- [`StyledElementBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimplext/)
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<ExecuteCommandBehaviorBase>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`DisposingBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-disposingbehaviorimpl/)
- [`AttachedToVisualTreeBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-attachedtovisualtreebehaviorimpl/)
- [`ExecuteCommandBehaviorBaseImpl`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-executecommandbehaviorbaseimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimpl/)

## Availability

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