maui icon indicating copy to clipboard operation
maui copied to clipboard

RadioButton application-level Style not working with ControlTemplate on iOS

Open fischberg opened this issue 1 year ago • 7 comments

Description

I'm using a ControlTemplate to define the look of my RadioButtons on a page. When I define the ControlTemplate and assign it as a Style to TargetType RadioButton in ContentPage.Resources the RadioButton behaves as expected on the ContentPage. If I move the ControlTemplate and the assignment of it as a Style to TargetType RadioButton in Styles.xaml as an Application level resource, the RadioButtons look as described in the ControlTemplate on iOS and Android but they do not respond to any clicks on iOS.

Steps to Reproduce

Build the app from the demo repository. You'll see the RadionButtons on MainPage are styled according to the ControlTemplate but they are unresponsive. If you move the ControlTemplate from Styles.xaml and put in as a ContentPage.Resource in MainPage.xaml, the RadioButtons respond as expected.

Link to public reproduction project repository

https://github.com/fischberg/RadioButtonControlTemplateBug

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

Tested on iOS 16.2 in emulator

Did you find any workaround?

Define the ControlTemplate as a page-level resource in ContentPage.Resources on every Page where I want to style RadioButton controls.

Relevant log output

No response

fischberg avatar May 05 '23 19:05 fischberg

Reference stackoverflow discussion at: https://stackoverflow.com/questions/76156173/radiobutton-application-level-style-not-working-with-controltemplate-on-ios-in-m

fischberg avatar May 05 '23 19:05 fischberg

Could you update the sample? https://github.com/fischberg/RadioButtonControlTemplateBug Looks empty.

jsuarezruiz avatar May 08 '23 14:05 jsuarezruiz

Hi @fischberg. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar May 08 '23 14:05 ghost

Sorry folks. Not sure what happened. The repo is updated.

fischberg avatar May 09 '23 01:05 fischberg

I run into the same issue and was struggling to figure out why.

I can confirm that it does indeed happen. When you try to style the button in Styles.xaml it's not working but when you move the ControlTemplate to the page where you want to use it, suddenly it works. I am lost for words...

@jsuarezruiz you can probably remove s/needs-info. Version 7.0.86

Actually, you don't even need to move the declaration of the ControlTemplate to the page-level. Just don't set ControlTemplate in the Style but set it in the place where you use the button.

Fyi, if you use Setter.Value and put your ControlTemplate there, it doesn't work either.

Hooterr avatar Jun 12 '23 14:06 Hooterr

Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on iOS 16.4, not repro on Windows 11 and Android 13.0-API33 with below Project: RadioButtonControlTemplateBug.zip

XamlTest avatar Jul 07 '23 03:07 XamlTest

Can confirm this is still an issue in v8

asi-evin avatar Jan 12 '24 16:01 asi-evin