Skip to content
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

Picker text colour not changing with theme #23760

Open
kycuff opened this issue Jul 22, 2024 · 4 comments
Open

Picker text colour not changing with theme #23760

kycuff opened this issue Jul 22, 2024 · 4 comments
Labels
area-controls-picker Picker migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 t/bug Something isn't working
Milestone

Comments

@kycuff
Copy link

kycuff commented Jul 22, 2024

Description

When changing an app theme via the ResourceDictionary the colour of the picker text is not changing

As can be seen in the video, the date and time pickers appear to be working.

2024-07-22.16-30-43.mp4

Issue appears to be just Android as iOS is working as expected.

Steps to Reproduce

No response

Link to public reproduction project repository

https://github.com/kycuff/PickerThemeTestApp

Version with bug

8.0.61 SR6.1

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@kycuff kycuff added the t/bug Something isn't working label Jul 22, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@PureWeen PureWeen added this to the Backlog milestone Jul 22, 2024
@samhouts samhouts added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Jul 24, 2024
@kubaflo
Copy link
Contributor

kubaflo commented Jul 27, 2024

Hi, @kycuff in your repo you're setting the TextColor(https://github.com/kycuff/PickerThemeTestApp/blob/6af6dfae1c625b81f910a20280c0fa13cb569fba/src/App/Routes/HomePage.xaml#L15), try setting the TitleColor like this

<Picker TitleColor="{DynamicResource TextSilverColour}" TextColor="{DynamicResource TextSilverColour}"/>

@IeuanWalker
Copy link

IeuanWalker commented Jul 29, 2024

@kubaflo both are being set in our codebase.

Can confirm setting TitleColor to a solid color (red) does change the UI control and the Popup title text color

But does not work when set to a dynamic resource

2024-07-29.17-42-18.mp4

I do feel like TextColor should work the same as all the other picker controls. And that TitleColor should only change the popup colour. Feels like that is a separate bug.

@IeuanWalker
Copy link

@kubaflo have found a workaround, that may help someone diagnose/ fix the bug.

As a workaround, I have found that even with the dynamic resources set, it does switch colour with Android theme changes.
So seems like something is overriding the set colours from xaml with the base Android theme colour

In styles.xml, I have 2 themes -

<?xml version="1.0" encoding="utf-8" ?>
<resources>
  <style name="Dark"  parent="Theme.MaterialComponents">
   *************
  </style>
  <style name="Light"  parent="Theme.MaterialComponents.Light">
   *************
  </style>
</resources>

Then switching between them when the user changes the theme -

Platform.CurrentActivity?.SetTheme(theme == ThemeEnum.Light ? Resource.Style.Light : Resource.Style.Dark);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-picker Picker migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants