# RadioButtons

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

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

```rust
struct RadioButtons
```

A group of radio buttons with one selection (WinUI's `RadioButtons`).

The items are shown as [`RadioButton`](/docs/0.5.0/api/ferroui-controls/struct-radiobutton/)s: an item that is a radio button is its own container,
and another item is the content of a radio button. The selection is the selection of the items
control (`SelectedIndex`, `SelectedItem`, `SelectionChanged`), kept with the checked state of
the containers. The arrow keys move the focus and the selection within the group without
wrapping, Tab enters the group at the selected button, and Ctrl with an arrow key moves the
focus only.

The template is the control theme of the WinUI theme (`Controls/RadioButtons.xaml`, from
WinUI's `RadioButtons.xaml`), with the parts `PART_HeaderPresenter` and `PART_ItemsPresenter`
(WinUI's `HeaderContentPresenter` and the `ItemsRepeater` `InnerRepeater`); the theme sets the
items panel, a `RadioButtonsPanel` with the spacing of
the resources `RadioButtonsColumnSpacing` and `RadioButtonsRowSpacing`. The Fluent and Simple
themes have no template for it (docs/porting/winui-controls.md, section 5.1).

The exclusive check is the radio button group manager's: the containers are the logical
children of the group and have no group name, so checking one unchecks the others. The group
itself only checks the container of a new selection, and unchecks the container of the old one
when no container is checked instead (a cleared selection, or one whose container is not
realized), which the group manager never does (WinUI's `Select` writes both containers).

Missing (docs/porting/winui-controls.md, Input): WinUI's element factories and
`DataTemplateSelector` as `ItemTemplate`.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`max_columns_property`](#function-max_columns_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`max_columns`](#function-max_columns)
- [`set_max_columns`](#function-set_max_columns)

<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/radio_buttons.rs#L59)

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

### to_ref

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

Returns a strong reference to this object.

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

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

### max_columns_property

```rust
fn max_columns_property() -> &'static StyledProperty<i32>
```

Defines the `MaxColumns` property: the largest number of columns. 1 by default; a value
less than 1 is 1 (WinUI rejects it with an exception).

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

<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/radio_buttons.rs#L225)

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

### new

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



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

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

### max_columns

```rust
fn max_columns(self: &Self) -> i32
```

Gets the largest number of columns.

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

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

### set_max_columns

```rust
fn set_max_columns(self: &Self, value: i32)
```

Sets the largest number of columns.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`HeaderedSelectingItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-headeredselectingitemscontrolimplext/)
- [`SelectingItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-selectingitemscontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`ItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimplext/)
- `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<RadioButtons>`](/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/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- [`SelectingItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-selectingitemscontrolimpl/)
- [`HeaderedSelectingItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-headeredselectingitemscontrolimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`ItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimpl/)

## Availability

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