Raj
Raj

Reputation: 40

RadioButton is not Checked when Checked property is set to true

When the checked property is true , the radio button is not checked in UWP. The radio buttons is not in the group. See the code below.

        <StackPanel Orientation="Horizontal">
        <RadioButton Content="1" IsChecked="True"/>
        <RadioButton IsChecked="True"/>
        </StackPanel>

You can see only the second radio button is checked.Why?

Upvotes: 0

Views: 652

Answers (2)

RAKESH KUMAR SAHU
RAKESH KUMAR SAHU

Reputation: 130

Purpose of RadioButton is that only single item will be selected at one time when RadioButtons are group together. If you want multiple selection at a time you can use CheckBox instead on RadioButton.

Upvotes: 1

Access Denied
Access Denied

Reputation: 9501

Because you grouped them by putting them into the same container. From UWP Radio Button documentation:

Radio buttons work in groups. There are 2 ways you can group radio button controls:

  • Put them inside the same parent container.
  • Set the GroupName property on each radio button to the same value.

Upvotes: 1

Related Questions