-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Radio button loses initial 'IsChecked=True' value when another radio button also has 'IsChecked=True' #11418
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
I got the shame problem here, when you create two separated layouts under the same BindingContext, the property RadioButtonGroup.SelectedValue works fine, but, even if you use different RadioButtonGroup.GroupName, occurs the same problem as @andycambo mentioned above, only the second pair of RadioButtons respect the initial binding, the first loaded unchecked. `
|
Same problem here. |
Apparently this is a known bug in WinUI: microsoft/microsoft-ui-xaml#2081 And I can reproduce that issue in UWP as well, so it's been a problem for a while. Not sure if we've ever run into this in Forms; if not, I wonder what we did that prevented it. |
Okay, I think we can hack around this in .NET MAUI until microsoft/microsoft-ui-xaml#2081 gets fixed. It's a little gross, but I think it'll work:
|
Just confirmed with VS 2022 17.5.0 |
### Description of Change This change sets a unique GroupName on every WinUI RadioButton created so that different groups of MAUI RadioButtons are not assumed by WinUI to share the same group and thus prevent IsChecked values from being set properly. ### Issues Fixed Fixes #11418
Description
There is an issue when trying to use multiple radio buttons on a page.
If there are two radio buttons set to 'IsChecked=True' then only the last button in the view will remain true - despite them being given different GroupNames and in separate parent containers.
Initial thoughts are that it appears that all the radio buttons on the view are treated as one group (tried to give the control different GroupNames as shown in example) and therefore, as the view is rendered in order, only the last radio button with IsChecked=True will keep its initial value, earlier radio buttons will be set to be unchecked.
In Android, the expected result is shown. I have been unable to test the remaining platforms.
Steps to Reproduce
Create a new solution.
Add to view multiple radio buttons with IsChecked=True
Link to public reproduction project repository
https://github.com/andycambo/MauiRadioButtonBugExample
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 10.0.19041.0
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: