# TransitionOperations

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-xaml-behaviors-animations/struct-transitionoperations/

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

```rust
struct TransitionOperations
```

Provides reusable operations for a styled element's transition collection.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/transitions/transition_operations.rs#L9)

## Members

- [`add`](#function-add)
- [`remove`](#function-remove)
- [`clear`](#function-clear)
- [`replace`](#function-replace)
- [`observe`](#function-observe)

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

### add

```rust
fn add(target: Option<&StyledElement>, transition: Option<&Ref<TransitionBase>>) -> bool
```

Adds a transition to an element, creating its collection when necessary. Returns `true`
when the transition was added; otherwise, `false`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/transitions/transition_operations.rs#L14)

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

### remove

```rust
fn remove(target: Option<&StyledElement>, transition: Option<&Ref<TransitionBase>>) -> bool
```

Removes a transition from an element. Returns `true` when the transition was removed;
otherwise, `false`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/transitions/transition_operations.rs#L34)

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

### clear

```rust
fn clear(target: Option<&StyledElement>) -> bool
```

Clears all transitions from an element. Returns `true` when an existing collection was
cleared; otherwise, `false`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/transitions/transition_operations.rs#L48)

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

### replace

```rust
fn replace(target: &StyledElement, transitions: Option<Transitions>) -> Option<Transitions>
```

Replaces an element's transitions and returns the previous collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/transitions/transition_operations.rs#L58)

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

### observe

```rust
fn observe(target: &StyledElement, observer: impl Fn(Option<Transitions>) -> () + 'static) -> Rc<dyn IDisposable>
```

Observes replacements of an element's transition collection: `observer` is invoked with
the current and subsequent transition collections. Returns a subscription that stops
observation when disposed.

The `ArgumentNullException` of the reference for a missing target or observer has no
counterpart: both are required by the types of the parameters.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Behaviors.Animations/transitions/transition_operations.rs#L70)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`

## Availability

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