RadioButton.GroupName 屬性

定義

取得或設定指定哪些 RadioButton 控制項為互斥的名稱。

public:
 property System::String ^ GroupName { System::String ^ get(); void set(System::String ^ value); };
[System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)]
public string GroupName { get; set; }
[<System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)>]
member this.GroupName : string with get, set
Public Property GroupName As String

屬性值

指定哪些 RadioButton 控制項為互的名稱。 預設為空字串。

屬性

範例

下列程式碼範例會建立兩個不同的 RadioButton 群組: colorgrpnumgrp 。 使用者可以在每個群組中選擇一個 RadioButton

<StackPanel>
    <RadioButton GroupName="colorgrp">Red</RadioButton>
    <RadioButton GroupName="colorgrp">Blue</RadioButton>
    <RadioButton GroupName="numgrp">1</RadioButton>
    <RadioButton GroupName="numgrp">2</RadioButton>
</StackPanel>

備註

當兩個或多個 RadioButton 控制項具有相同時 GroupName ,使用者一次只能選取一個 RadioButton

相依性屬性資訊

識別碼欄位 GroupNameProperty
中繼資料屬性設定為 true

適用於