RadioButton.GroupName Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

[LocalizabilityAttribute(LocalizationCategory.NeverLocalize)]
public string GroupName { get; set; }

Property Value

Type: System.String

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

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

Identifier field

GroupNameProperty

Metadata properties set to true

None

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>

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: