Edit

Bagikan melalui


RadioButton.GroupName Property

Definition

Gets or sets the name that specifies which RadioButton controls are mutually exclusive.

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

Property Value

The name that specifies which RadioButton controls are mutually exclusive. The default is an empty string.

Attributes

Examples

The following code sample creates two separate RadioButton groups: colorgrp and numgrp. The user can choose one RadioButton in each group.

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

Remarks

When two or more RadioButton controls have the same GroupName, a user can select only one RadioButton at a time.

Dependency Property Information

Identifier field GroupNameProperty
Metadata properties set to true None

Applies to