# KeyTrigger

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

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

```rust
struct KeyTrigger
```

A trigger that listens for key events and executes its actions when the specified key or
gesture is detected.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L30)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`key_property`](#function-key_property)
- [`gesture_property`](#function-gesture_property)
- [`event_property`](#function-event_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`key`](#function-key)
- [`set_key`](#function-set_key)
- [`gesture`](#function-gesture)
- [`set_gesture`](#function-set_gesture)
- [`event`](#function-event)
- [`set_event`](#function-set_event)

<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/input_element/triggers/key_trigger.rs#L34)

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

### to_ref

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

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L34)

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

### key_property

```rust
fn key_property() -> &'static StyledProperty<Option<Key>>
```

Identifies the `key` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L44)

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

### gesture_property

```rust
fn gesture_property() -> &'static StyledProperty<Option<KeyGesture>>
```

Identifies the `gesture` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L44)

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

### event_property

```rust
fn event_property() -> &'static StyledProperty<FiredOn>
```

Identifies the `event` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L44)

<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/input_element/triggers/key_trigger.rs#L98)

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

### new

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

Creates a trigger.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L103)

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

### key

```rust
fn key(self: &Self) -> Option<Key>
```

Gets or sets the key to listen for. This is a property of the object model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L108)

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

### set_key

```rust
fn set_key(self: &Self, value: Option<Key>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L112)

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

### gesture

```rust
fn gesture(self: &Self) -> Option<KeyGesture>
```

Gets or sets the key gesture to match. This is a property of the object model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L117)

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

### set_gesture

```rust
fn set_gesture(self: &Self, value: Option<KeyGesture>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L121)

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

### event

```rust
fn event(self: &Self) -> FiredOn
```

Gets or sets which key event fires the trigger. This is a property of the object model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L126)

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

### set_event

```rust
fn set_event(self: &Self, value: FiredOn)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactions.Custom/input_element/triggers/key_trigger.rs#L130)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`AttachedToVisualTreeTriggerBaseImplExt`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-attachedtovisualtreetriggerbaseimplext/)
- [`RoutedEventTriggerBaseOfTImplExt`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-routedeventtriggerbaseoftimplext/)
- `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`
- [`StyledElementBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimplext/)
- [`DisposingTriggerImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-disposingtriggerimplext/)
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<KeyTrigger>`](/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/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`StyledElementBehaviorImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimpl/)
- [`DisposingTriggerImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-disposingtriggerimpl/)
- [`AttachedToVisualTreeTriggerBaseImpl`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-attachedtovisualtreetriggerbaseimpl/)
- [`RoutedEventTriggerBaseOfTImpl`](/docs/0.5.0/api/ferroui-xaml-interactions-custom/trait-routedeventtriggerbaseoftimpl/)

## Availability

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