# ReactiveView

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

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

```rust
struct ReactiveView<C: ITypedReactiveViewClass, VM: PartialEq + 'static>
```

A reactive view class instance typed by its view model (`ReactiveUserControl<TViewModel>`,
`ReactiveWindow<TViewModel>`): a handle that dereferences to the control and, shared as an
`Rc`, is its `IViewFor<TViewModel>`.

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

## Members

- [`new`](#function-new)
- [`from_control`](#function-from_control)
- [`control`](#function-control)
- [`view_model`](#function-view_model)
- [`set_view_model`](#function-set_view_model)
- [`into_view_for_of`](#function-into_view_for_of)
- [`into_view_for`](#function-into_view_for)

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

### new

```rust
fn new() -> Self
```

A new control of the class, typed by `VM` (`new ReactiveUserControl<TViewModel>()`).

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

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

### from_control

```rust
fn from_control(control: impl IntoRef<C>) -> Self
```

`control` (an instance of the class or of a class derived from it, as one of markup), typed
by `VM`: from now on it takes only view models of type `VM` from its `DataContext`.

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

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

### control

```rust
fn control(self: &Self) -> &Ref<C>
```

The control.

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

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

### view_model

```rust
fn view_model(self: &Self) -> Option<Rc<VM>>
```

The view model (`ViewModel { get; }`): `None` when the control holds none, or holds a view
model of another type (which only the untyped `IViewFor` can set).

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

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

### set_view_model

```rust
fn set_view_model(self: &Self, view_model: Option<Rc<VM>>)
```

Sets the view model (`ViewModel { set; }`).

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

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

### into_view_for_of

```rust
fn into_view_for_of(self: Self) -> Rc<dyn IViewForOf<VM>>
```

The view as `IViewFor<TViewModel>`.

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

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

### into_view_for

```rust
fn into_view_for(self: Self) -> Rc<dyn IViewFor>
```

The view as `IViewFor`.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ToOwned`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`IntoViewFor`](/docs/0.5.0/api/ferroui-reactiveui/binding/interfaces/trait-intoviewfor/)
- `Clone`
- `Default`
- `Deref`
- [`IViewControl`](/docs/0.5.0/api/ferroui-reactiveui-controls/trait-iviewcontrol/)
- [`IActivatableView`](/docs/0.5.0/api/ferroui-reactiveui/binding/interfaces/trait-iactivatableview/)
- [`IViewFor`](/docs/0.5.0/api/ferroui-reactiveui/binding/interfaces/trait-iviewfor/)
- [`IViewForOf<VM>`](/docs/0.5.0/api/ferroui-reactiveui/binding/interfaces/trait-iviewforof/)

## Availability

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