xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] [iOS] Radio Button Not Working when Control Template Set in App.xaml #14909

Open djrpascu opened 2 years ago

djrpascu commented 2 years ago

Description

When setting the control template for Radio Button in App.xaml, so that it applies to all instances of that control in the application, the Radio Button breaks (for iOS only). The style seems to be applied, but it's as if it's disabled, I'm unable to check or uncheck it. If I set the control template in App.xaml, it works for UWP, but not for iOS.

Steps to Reproduce

  1. Define a Control Template in App.xaml and set it for Radio Button like so:
            <Style TargetType="RadioButton">
                <Setter Property="ControlTemplate" Value="{StaticResource RadioButtonTemplate}" />
            </Style>
  2. Run it for iOS, see that the buttons can't be checked/unchecked.

Expected Behavior

Radio buttons should be interactive, able to check and uncheck them.

Actual Behavior

Radio buttons seem to be disabled, unable to check/uncheck them.

Basic Information

Environment

Show/Hide Visual Studio info ``` ```

Build Logs

Screenshots

Reproduction Link

https://github.com/djrpascu/XFRadioButtonControlTemplateIssue

Workaround

Set control template on Radio Button in each ContentPage.Resources where you have a Radio Button defined.

wodyy666 commented 2 years ago

Ran into the same issue today. RadioButton is working fine on Android but to make it work on iOS I have to move the declaration of the control template from App.xaml to the ContentPage directly.