# ViewModelPropertySync

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui-controls/struct-viewmodelpropertysync/

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

```rust
struct ViewModelPropertySync
```

Keeps a view's view model property and its data context in step (`ViewModelPropertySync`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/view_model_property_sync.rs#L15)

## Members

- [`forward_activation`](#function-forward_activation)
- [`apply`](#function-apply)

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

### forward_activation

```rust
fn forward_activation<C: IReactiveViewClass>(view: &Ref<C>)
```

Forwards the view's activation to its view model when the view model takes part in
activation (`ForwardActivation`).

The observable of the view model property tells ReactiveUI when the view model changes.
The view activates itself through a view that refers to it weakly, so that the handlers of
its activation do not keep it alive.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/view_model_property_sync.rs#L24)

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

### apply

```rust
fn apply(view: &StyledElement, change: &FerroPropertyChangedEventArgs<'_>, view_model_property: &'static StyledProperty<Option<BoxedValue>>, is_valid_view_model_value: impl Fn(Option<&BoxedValue>) -> bool)
```

Propagates a change between the view model property and the data context (`Apply`).

`is_valid_view_model_value` decides whether an incoming data context may become the view
model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI.Controls/view_model_property_sync.rs#L36)

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