Share via


RadioButtons.MaxColumns Property

Definition

Gets or sets the maximum number of columns the radio buttons are arranged in.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

public:
 property int MaxColumns { int get(); void set(int value); };
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")]
int MaxColumns();

void MaxColumns(int value);
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")]
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")]
int MaxColumns();

void MaxColumns(int value);
public int MaxColumns { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")] set; }
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")]
public int MaxColumns { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="1")] set; }
Public Property MaxColumns As Integer

Property Value

Int32

int

The maximum number of columns the radio buttons are arranged in. The default is 1.

Attributes
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValueAttribute

Examples

<!-- xmlns:muxc="using:Microsoft.UI.Xaml.Controls -->
<muxc:RadioButtons Header="Options" MaxColumns="3">
    <x:String>Item 1</x:String>
    <x:String>Item 2</x:String>
    <x:String>Item 3</x:String>
    <x:String>Item 4</x:String>
    <x:String>Item 5</x:String>
    <x:String>Item 6</x:String>
</muxc:RadioButtons>

Six radio buttons arranged in three columns

Remarks

For more info, design guidance, and code examples, see Radio buttons.

By default, the RadioButtons control arranges its radio buttons vertically in a single column. You can set the MaxColumns property to make the control arrange the radio buttons in multiple columns. (When you do this, they are laid out in column-major order, where items fill in from top to bottom, then left to right.)

To have items arranged in a single horizontal row, set MaxColumns equal to the number of items in the group.

Applies to

See also