Share via


RadioButtons.MaxColumns 属性

定义

获取或设置单选按钮所排列的最大列数。

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; }
var int32 = radioButtons.maxColumns;
radioButtons.maxColumns = int32;
Public Property MaxColumns As Integer

属性值

Int32

int

单选按钮排列的最大列数。 默认值为 1。

属性
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValueAttribute

示例

<!-- 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>

以三列排列的六个单选按钮

注解

有关详细信息、设计指南和代码示例,请参阅 单选按钮

默认情况下,RadioButtons 控件在单个列中垂直排列其单选按钮。 可以设置 MaxColumns 属性,使控件在多个列中排列单选按钮。 (执行此操作时,单选按钮按列主序顺序排列,即各个项按照从上到下、然后从左到右的顺序填充。)

要将项排列在单个水平行中,请将 MaxColumns 设置为组中的项数。

适用于

另请参阅