# SplitButton

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

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

```rust
struct SplitButton
```

A button with primary and secondary parts that can each be pressed
separately. The primary part behaves like a [`Button`](/docs/0.5.0/api/ferroui-controls/struct-button/) and the secondary
part opens a flyout.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`internal_is_checked`](#function-internal_is_checked)
- [`on_click_primary`](#function-on_click_primary)
- [`on_click_secondary`](#function-on_click_secondary)
- [`on_flyout_opened`](#function-on_flyout_opened)
- [`on_flyout_closed`](#function-on_flyout_closed)
- [`TEMPLATE_PARTS`](#assoc_const-template_parts)
- [`PSEUDO_CLASSES`](#assoc_const-pseudo_classes)
- [`click_event`](#function-click_event)
- [`command_property`](#function-command_property)
- [`command_parameter_property`](#function-command_parameter_property)
- [`flyout_property`](#function-flyout_property)
- [`hot_key_property`](#function-hot_key_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`click`](#function-click)
- [`command`](#function-command)
- [`set_command`](#function-set_command)
- [`command_parameter`](#function-command_parameter)
- [`set_command_parameter`](#function-set_command_parameter)
- [`flyout`](#function-flyout)
- [`set_flyout`](#function-set_flyout)
- [`hot_key`](#function-hot_key)
- [`set_hot_key`](#function-set_hot_key)
- [`update_pseudo_classes`](#function-update_pseudo_classes)
- [`open_flyout`](#function-open_flyout)
- [`close_flyout`](#function-close_flyout)

<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/split_button/split_button.rs#L58)

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

### to_ref

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

Returns a strong reference to this object.

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

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

### internal_is_checked

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

A value indicating whether the button is currently checked.

This member exists only for the derived toggle split button and
is unused (false) within the split button. Doing this allows the
two controls to share a default style.

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

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

### on_click_primary

```rust
fn on_click_primary(self: &Self, e: Option<&RoutedEventArgs>)
```

Invokes the `Click` event when the primary button part is
clicked. `e` are the event args from the internal click event.

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

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

### on_click_secondary

```rust
fn on_click_secondary(self: &Self, e: Option<&RoutedEventArgs>)
```

Invoked when the secondary button part is clicked. `e` are the
event args from the internal click event.

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

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

### on_flyout_opened

```rust
fn on_flyout_opened(self: &Self)
```

Invoked when the split button's flyout is opened.

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

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

### on_flyout_closed

```rust
fn on_flyout_closed(self: &Self)
```

Invoked when the split button's flyout is closed.

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

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

### TEMPLATE_PARTS

```rust
const TEMPLATE_PARTS: &'static [TemplatePartAttribute]
```

The named parts expected in the control template, in addition to
those of the base class.

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

<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/split_button/split_button.rs#L363)

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

### click_event

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

Defines the `Click` event.

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

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

### command_property

```rust
fn command_property() -> &'static StyledProperty<Option<Rc<dyn ICommand>>>
```

Defines the `Command` property.

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

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

### command_parameter_property

```rust
fn command_parameter_property() -> &'static StyledProperty<Option<BoxedValue>>
```

Defines the `CommandParameter` property.

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

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

### flyout_property

```rust
fn flyout_property() -> &'static StyledProperty<Option<Ref<FlyoutBase>>>
```

Defines the `Flyout` property.

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

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

### hot_key_property

```rust
fn hot_key_property() -> &'static StyledProperty<Option<KeyGesture>>
```

Defines the `HotKey` property.

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

<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/split_button/split_button.rs#L410)

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

### new

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

Creates a split button.

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

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

### click

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

Raised when the user presses the primary part of the split button.

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

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

### command

```rust
fn command(self: &Self) -> Option<Rc<dyn ICommand>>
```

The command invoked when the primary part is pressed.

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

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

### set_command

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



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

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

### command_parameter

```rust
fn command_parameter(self: &Self) -> Option<BoxedValue>
```

A parameter to be passed to the `Command`.

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

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

### set_command_parameter

```rust
fn set_command_parameter(self: &Self, value: Option<BoxedValue>)
```



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

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

### flyout

```rust
fn flyout(self: &Self) -> Option<Ref<FlyoutBase>>
```

The flyout that will be shown when the secondary part is pressed.

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

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

### set_flyout

```rust
fn set_flyout(self: &Self, value: impl Into<Nullable<FlyoutBase>>)
```



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

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

### hot_key

```rust
fn hot_key(self: &Self) -> Option<KeyGesture>
```

A key gesture associated with this control.

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

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

### set_hot_key

```rust
fn set_hot_key(self: &Self, value: Option<KeyGesture>)
```



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

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

### update_pseudo_classes

```rust
fn update_pseudo_classes(self: &Self)
```

Updates the visual state of the control by applying the latest
pseudoclasses.

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

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

### open_flyout

```rust
fn open_flyout(self: &Self)
```

Opens the secondary button's flyout.

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

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

### close_flyout

```rust
fn close_flyout(self: &Self)
```

Closes the secondary button's flyout.

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

## 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/)
- [`SplitButtonImplExt`](/docs/0.5.0/api/ferroui-controls/trait-splitbuttonimplext/)
- `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<SplitButton>`](/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/)
- [`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/)
- [`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/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- [`SplitButtonImpl`](/docs/0.5.0/api/ferroui-controls/trait-splitbuttonimpl/)

## Availability

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