GroupName Property
Collapse the table of content
Expand the table of content

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