# ViewModelActivationMixins

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/activation/trait-viewmodelactivationmixins/

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

```rust
trait ViewModelActivationMixins: IActivatableViewModel + Sized
```

The activation of view models (the extension members of `IActivatableViewModel` in
`ViewForMixins`): what to do while the view model is active, registered with its
`ViewModelActivator`.

The blocks run when the activator is activated, and what they set up is disposed when it is
deactivated. Registering a block also makes the type of the view model known as activatable
([`register_activatable_view_model`](/docs/0.5.0/api/ferroui-reactiveui/activation/function-register_activatable_view_model/)), so that the views that show it activate it.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/activation/view_for_mixins.rs#L246)

## Members

- [`when_activated`](#function-when_activated)
- [`when_activated_register`](#function-when_activated_register)
- [`when_activated_disposables`](#function-when_activated_disposables)

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

### when_activated

```rust
fn when_activated(self: &Self, block: impl Fn() -> Vec<Rc<dyn IDisposable>> + 'static)
```

Runs `block` on each activation; what it returns is disposed on deactivation
(`WhenActivated(Func<IEnumerable<IDisposable>>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/activation/view_for_mixins.rs#L249)

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

### when_activated_register

```rust
fn when_activated_register(self: &Self, block: impl Fn(&dyn Fn(Rc<dyn IDisposable>) -> ()) -> () + 'static)
```

Runs `block` on each activation; the block registers what to dispose on deactivation with
the function it is given (`WhenActivated(Action<Action<IDisposable>>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/activation/view_for_mixins.rs#L256)

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

### when_activated_disposables

```rust
fn when_activated_disposables(self: &Self, block: impl Fn(&Rc<ActivationDisposables>) -> () + 'static)
```

Runs `block` on each activation with the `ActivationDisposables` disposed on
deactivation (`WhenActivated(Action<ActivationDisposables>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/activation/view_for_mixins.rs#L262)

## Trait implementations

- [`ViewModelActivationMixins`](/docs/0.5.0/api/ferroui-reactiveui/activation/trait-viewmodelactivationmixins/)

## Availability

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