# VisualStateGroup

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

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

```rust
struct VisualStateGroup
```

A group of mutually exclusive [`VisualState`](/docs/0.5.0/api/ferroui-controls/visual_state/struct-visualstate/)s: at most one of them is the
`current_state` of the group, null at first.

The groups of an element are the attached
`VisualStateManager::visual_state_groups_property`;
`VisualStateManager::go_to_state` changes the state of the group that has the state of the
name it is given.

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

## 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)
- [`states`](#function-states)
- [`current_state`](#function-current_state)
- [`current_state_changing`](#function-current_state_changing)
- [`current_state_changed`](#function-current_state_changed)

<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_group.rs#L41)

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

### to_ref

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

Returns a strong reference to this object.

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

<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_group.rs#L57)

<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_group.rs#L71)

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

### with_name

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

Creates a group with a name.

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

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

### name

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

The name of the group.

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

<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`).

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

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

### states

```rust
fn states(self: &Self) -> FerroList<Ref<VisualState>>
```

The states of the group.

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

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

### current_state

```rust
fn current_state(self: &Self) -> Option<Ref<VisualState>>
```

The current state of the group: `None` until a state is entered.

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

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

### current_state_changing

```rust
fn current_state_changing(self: &Self, handler: impl Fn(&Ref<VisualStateGroup>, &VisualStateChangedEventArgs) -> () + 'static) -> Subscription
```

Adds a handler of `CurrentStateChanging`, raised when a change of state begins.

Dropping the returned guard removes the handler; `Subscription::detach` keeps it for
the life of the group.

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

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

### current_state_changed

```rust
fn current_state_changed(self: &Self, handler: impl Fn(&Ref<VisualStateGroup>, &VisualStateChangedEventArgs) -> () + 'static) -> Subscription
```

Adds a handler of `CurrentStateChanged`, raised when a change of state has completed.

Dropping the returned guard removes the handler; `Subscription::detach` keeps it
for the life of the group.

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

## 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<VisualStateGroup>`](/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/)
- `Drop`

## Availability

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