# IToggleProvider

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/automation/provider/trait-itoggleprovider/

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

```rust
trait IToggleProvider
```

Exposes methods and properties to support UI Automation client access to controls that can
cycle through a set of states and maintain a particular state.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/automation/provider/i_toggle_provider.rs#L21)

## Members

- [`peer`](#function-peer)
- [`toggle_state`](#function-toggle_state)
- [`toggle`](#function-toggle)

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

### peer

```rust
fn peer(self: &Self) -> Ref<AutomationPeer>
```

The automation peer that provides this contract.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/automation/provider/i_toggle_provider.rs#L23)

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

### toggle_state

```rust
fn toggle_state(self: &Self) -> ToggleState
```

Gets the toggle state of the control.

Windows: `IToggleProvider.ToggleState`. macOS: `NSAccessibilityProtocol.accessibilityValue`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/automation/provider/i_toggle_provider.rs#L28)

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

### toggle

```rust
fn toggle(self: &Self) -> Result<(), AutomationError>
```

Cycles through the toggle states of a control.

Windows: `IToggleProvider.Toggle`. macOS: `NSAccessibilityProtocol.accessibilityPerformPress`.
## Errors

An `AutomationError` when the state of the element refuses the call
(the exception the member throws in the original).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/automation/provider/i_toggle_provider.rs#L38)

## Trait implementations

- [`IToggleProvider`](/docs/0.5.0/api/ferroui-controls/automation/provider/trait-itoggleprovider/)

## Availability

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