Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

RadioButton.GroupName Property

 

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:
© 2017 Microsoft