# EventTriggerBase

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-interactivity/struct-eventtriggerbase/

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

```rust
struct EventTriggerBase
```

A behavior that listens for a specified event on its source and executes its actions when that
event is fired.

The event is found by name: first in the [`AddEventHandlerRegistry`](/docs/0.5.0/api/ferroui-xaml-interactivity/struct-addeventhandlerregistry/), then among the routed
events of the source and the plain events its markup metadata declares (the reflection of the
reference; see `member_lookup`). The default event,
`AttachedToVisualTree`, fires when a control without a parent is attached to the visual tree.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L31)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`attached_to_visual_tree`](#function-attached_to_visual_tree)
- [`on_event`](#function-on_event)
- [`event_name_property`](#function-event_name_property)
- [`source_object_property`](#function-source_object_property)
- [`construct`](#function-construct)
- [`event_name`](#function-event_name)
- [`set_event_name`](#function-set_event_name)
- [`source_object`](#function-source_object)
- [`set_source_object`](#function-set_source_object)
- [`resolved_source`](#function-resolved_source)

<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.Interactivity/triggers/event_trigger_base.rs#L42)

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

### to_ref

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

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L42)

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

### attached_to_visual_tree

```rust
fn attached_to_visual_tree(self: &Self, sender: Option<&BoxedValue>, event_args: &BoxedValue)
```

Raised when the event fires (by its name in the reference, the handler of the default
event `AttachedToVisualTree`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L42)

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

### on_event

```rust
fn on_event(self: &Self, event_args: Option<&BoxedValue>)
```

Executes the actions associated with this behavior.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L42)

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

### event_name_property

```rust
fn event_name_property() -> &'static StyledProperty<Option<String>>
```

Identifies the `EventName` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L76)

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

### source_object_property

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

Identifies the `SourceObject` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L76)

<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.Interactivity/triggers/event_trigger_base.rs#L145)

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

### event_name

```rust
fn event_name(self: &Self) -> Option<String>
```

Gets or sets the name of the event to listen for.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L157)

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

### set_event_name

```rust
fn set_event_name(self: &Self, value: Option<String>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L161)

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

### source_object

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

Gets or sets the source object from which this behavior listens for events. If it is not
set, the source defaults to the associated object. Markup resolves a name given for it to
the named element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L168)

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

### set_source_object

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L172)

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

### resolved_source

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

The source the trigger listens to.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/triggers/event_trigger_base.rs#L177)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`StyledElementBehaviorImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-styledelementbehaviorimplext/)
- [`EventTriggerBaseImplExt`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-eventtriggerbaseimplext/)
- `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`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<EventTriggerBase>`](/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/)
- [`EventTriggerBaseImpl`](/docs/0.5.0/api/ferroui-xaml-interactivity/trait-eventtriggerbaseimpl/)
- [`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/).
