# Expander

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

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

```rust
struct Expander
```

A control with a header that has a collapsible content section.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`on_collapsed`](#function-on_collapsed)
- [`on_collapsing`](#function-on_collapsing)
- [`on_expanded`](#function-on_expanded)
- [`on_expanding`](#function-on_expanding)
- [`on_coerce_is_expanded`](#function-on_coerce_is_expanded)
- [`PSEUDO_CLASSES`](#assoc_const-pseudo_classes)
- [`content_transition_property`](#function-content_transition_property)
- [`expand_direction_property`](#function-expand_direction_property)
- [`is_expanded_property`](#function-is_expanded_property)
- [`collapsed_event`](#function-collapsed_event)
- [`collapsing_event`](#function-collapsing_event)
- [`expanded_event`](#function-expanded_event)
- [`expanding_event`](#function-expanding_event)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`content_transition`](#function-content_transition)
- [`set_content_transition`](#function-set_content_transition)
- [`expand_direction`](#function-expand_direction)
- [`set_expand_direction`](#function-set_expand_direction)
- [`is_expanded`](#function-is_expanded)
- [`set_is_expanded`](#function-set_is_expanded)
- [`collapsed`](#function-collapsed)
- [`collapsing`](#function-collapsing)
- [`expanded`](#function-expanded)
- [`expanding`](#function-expanding)

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

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

### to_ref

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

Returns a strong reference to this object.

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

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

### on_collapsed

```rust
fn on_collapsed(self: &Self, event_args: &RoutedEventArgs)
```

Raises the `Collapsed` event.

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

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

### on_collapsing

```rust
fn on_collapsing(self: &Self, event_args: &CancelRoutedEventArgs)
```

Raises the `Collapsing` event.

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

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

### on_expanded

```rust
fn on_expanded(self: &Self, event_args: &RoutedEventArgs)
```

Raises the `Expanded` event.

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

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

### on_expanding

```rust
fn on_expanding(self: &Self, event_args: &CancelRoutedEventArgs)
```

Raises the `Expanding` event.

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

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

### on_coerce_is_expanded

```rust
fn on_coerce_is_expanded(self: &Self, value: bool) -> bool
```

Called when the `IsExpanded` property has to be coerced.

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

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

### PSEUDO_CLASSES

```rust
const PSEUDO_CLASSES: PseudoClassesAttribute
```

The pseudoclasses set by the class.

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

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

### content_transition_property

```rust
fn content_transition_property() -> &'static StyledProperty<Option<Rc<dyn IPageTransition>>>
```

Defines the `ContentTransition` property.

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

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

### expand_direction_property

```rust
fn expand_direction_property() -> &'static StyledProperty<ExpandDirection>
```

Defines the `ExpandDirection` property.

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

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

### is_expanded_property

```rust
fn is_expanded_property() -> &'static StyledProperty<bool>
```

Defines the `IsExpanded` property.

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

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

### collapsed_event

```rust
fn collapsed_event() -> &'static RoutedEvent<RoutedEventArgs>
```

Defines the `Collapsed` event.

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

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

### collapsing_event

```rust
fn collapsing_event() -> &'static RoutedEvent<CancelRoutedEventArgs>
```

Defines the `Collapsing` event.

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

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

### expanded_event

```rust
fn expanded_event() -> &'static RoutedEvent<RoutedEventArgs>
```

Defines the `Expanded` event.

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

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

### expanding_event

```rust
fn expanding_event() -> &'static RoutedEvent<CancelRoutedEventArgs>
```

Defines the `Expanding` event.

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

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

### construct

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

Creates the class data; see `ferroui_base::FerroObject::construct`.

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

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

### new

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



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

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

### content_transition

```rust
fn content_transition(self: &Self) -> Option<Rc<dyn IPageTransition>>
```

The transition used when expanding or collapsing the content.

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

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

### set_content_transition

```rust
fn set_content_transition(self: &Self, value: Option<Rc<dyn IPageTransition>>)
```



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

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

### expand_direction

```rust
fn expand_direction(self: &Self) -> ExpandDirection
```

The direction in which the expander opens.

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

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

### set_expand_direction

```rust
fn set_expand_direction(self: &Self, value: ExpandDirection)
```



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

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

### is_expanded

```rust
fn is_expanded(self: &Self) -> bool
```

Whether the content area of the expander is open and visible.

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

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

### set_is_expanded

```rust
fn set_is_expanded(self: &Self, value: bool)
```



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

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

### collapsed

```rust
fn collapsed(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Occurs after the content area has closed and only the header is
visible.

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

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

### collapsing

```rust
fn collapsing(self: &Self, handler: impl Fn(&Interactive, &CancelRoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Occurs as the content area is closing.

The `cancel` property of the event args may be set to true to cancel
the event and keep the control open (expanded).

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

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

### expanded

```rust
fn expanded(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Occurs after the expander has opened to display both its header and
content.

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

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

### expanding

```rust
fn expanding(self: &Self, handler: impl Fn(&Interactive, &CancelRoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
```

Occurs as the content area is opening.

The `cancel` property of the event args may be set to true to cancel
the event and keep the control closed (collapsed).

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`ContentControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-contentcontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`ExpanderImplExt`](/docs/0.5.0/api/ferroui-controls/trait-expanderimplext/)
- `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`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<Expander>`](/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/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- [`ContentControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-contentcontrolimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`ExpanderImpl`](/docs/0.5.0/api/ferroui-controls/trait-expanderimpl/)

## Availability

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