語言

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

範例

<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>
</RadioButtons>

六個無線電按鈕,分三列排列

備註

欲了解更多資訊、設計指引及程式碼範例,請參閱 單選按鈕。

根據預設,RadioButtons 控制項會在單一欄中垂直排列其單選按鈕。 你可以設定 MaxColumns 屬性讓控制按鈕將單選按鈕排列成多欄。 (當您這樣做時,它們會以列為主順序配置,其中元素會從上到下填入,然後由左至右填入。)

若要將項目排列在單一水平一列中,請設定 MaxColumns 為該組中的項目數目。

適用於

另請參閱