# ReversiblePropertyChange

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

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

```rust
struct ReversiblePropertyChange<TTarget, TValue>
```

Coordinates reversible, typed property changes across action instances.

`TTarget` is the handle of the target (`Ref<Button>`, `Rc<ViewModel>`), `TValue` the type of
the value of the property.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/reversible_property_change.rs#L338)

## Members

- [`new`](#function-new)
- [`apply`](#function-apply)
- [`revert`](#function-revert)
- [`property_name`](#function-property_name)

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

### new

```rust
fn new(property_name: &str) -> Self
```

Initializes a new reversible property-change coordinator for the property `property_name`.
## Panics
Panics if the name is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/reversible_property_change.rs#L349)

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

### apply

```rust
fn apply(self: &Self, target: &TTarget, value: TValue, getter: impl Fn(&TTarget) -> TValue + 'static, setter: impl Fn(&TTarget, TValue) -> () + 'static) -> bool
```

Applies a value while preserving the state required to revert it. `getter` gets the current
property value, `setter` sets it. Returns true when the reversible value was applied.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/reversible_property_change.rs#L360)

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

### revert

```rust
fn revert(self: &Self, _setter: impl Fn(&TTarget, TValue) -> ()) -> bool
```

Reverts the value previously applied by this coordinator. Returns true when an applied
value was reverted.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/reversible_property_change.rs#L416)

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

### property_name

```rust
fn property_name(self: &Self) -> &str
```

The name of the property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Behaviors/FerroUI.Xaml.Interactivity/helpers/reversible_property_change.rs#L421)

## 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/).
