Skip to content

Implicitly grouped RadioButtons are treated as in the same group #1299

@nxtn

Description

@nxtn

Describe the bug

Only one of implicitly grouped RadioButtons can be set to IsChecked programmatically.

Steps to reproduce the bug

<Page
    x:Class="App1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <Button>
            <Button.Flyout>
                <Flyout>
                    <StackPanel>
                        <RadioButton x:Name="RadioButton1" IsChecked="True" />
                    </StackPanel>
                </Flyout>
            </Button.Flyout>
        </Button>
        <Button>
            <Button.Flyout>
                <Flyout>
                    <StackPanel>
                        <RadioButton x:Name="RadioButton2" IsChecked="True" />
                    </StackPanel>
                </Flyout>
            </Button.Flyout>
        </Button>
    </Grid>
</Page>
using System.Diagnostics;
using Windows.UI.Xaml.Controls;

namespace App1
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            InitializeComponent();
            Debug.WriteLine(RadioButton1.IsChecked);
            Debug.WriteLine(RadioButton2.IsChecked);
        }
    }
}

Expected behavior

True
True

Actual behavior

False
True

Version Info

Windows 10 version Saw the problem?
May 2019 Update (18362) Yes
Device form factor Saw the problem?
Desktop Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-RadioButtonsduplicateThis issue or pull request already existsneeds-winui-3Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3)team-ControlsIssue for the Controls team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions