# VisualState

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/visual_state/struct-visualstate/

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

```rust
struct VisualState
```

A visual state: the values its `setters` set while it is the current state
of its `VisualStateGroup`.

The setters are setters with a `target`: markup writes
`<Setter Target="Element.Property" Value="..."/>`. They are applied at animation priority, above
local values and styles, and removed when the group leaves the state
(docs/porting/winui-calculator-gaps.md, section 5.5).

Deviation (docs/porting/winui-controls.md, VisualStateManager): `x:Name` names the state but
does not register it in the name scope, so `find_name` does not find it.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`with_name`](#function-with_name)
- [`name`](#function-name)
- [`set_name`](#function-set_name)
- [`setters`](#function-setters)
- [`state_triggers`](#function-state_triggers)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L32)

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

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<VisualState>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L32)

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

### construct

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L47)

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

### new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L56)

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

### with_name

```rust
fn with_name(name: impl Into<String>) -> Ref<Self>
```

Creates a state with a name.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L61)

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

### name

```rust
fn name(self: &Self) -> String
```

The name of the state, which `VisualStateManager::go_to_state` is given.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L68)

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

### set_name

```rust
fn set_name(self: &Self, value: impl Into<String>)
```

Sets the name (WinUI's `x:Name`; the name is read-only in WinUI once the state is
loaded).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L74)

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

### setters

```rust
fn setters(self: &Self) -> FerroList<Rc<dyn SetterBase>>
```

The setters of the state (WinUI's `SetterBaseCollection`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L84)

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

### state_triggers

```rust
fn state_triggers(self: &Self) -> FerroList<Ref<StateTriggerBase>>
```

The triggers of the state: the state is a candidate to be the current state of its group
while one of them is active (several triggers of a state are alternatives).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/visual_state/visual_state.rs#L90)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<VisualState>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)

## Availability

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