語言

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 的群組: colorgrp 和 numgrp。 使用者可以在每個群組中選擇一個 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 。

相依財產資訊

Item 價值觀
識別碼欄位 GroupNameProperty
元資料屬性設為 true None

適用於