Xamarin.forms: [Bug] Switch Background can not be seen on black Background in dark mode

Created on 20 Oct 2020  路  8Comments  路  Source: xamarin/Xamarin.Forms

Description

When we have a black background in dark mode we can only see the thumb of the switch, however not the background

Steps to Reproduce

  1. Set Dark Mode Android
  2. Add a switch on a black background
  3. Watch

Expected Behavior

Switch Off Color should be possible to set to white

Actual Behavior

Switch Off Color can not be shown

Basic Information

  • Version with issue: Xamarin Forms 4.8.0.1451
  • Last known good version: None
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:

    • iOS:

    • Android: Android 10

    • UWP:

  • Android Support Library Version: Android X
  • Nuget Packages: Xamarin Visual Material
  • Affected Devices:

Screenshots

image

Workaround

No workaround

It would be perfect when there would be a BindableProperty OffColor to set for Switch.

darkmode switch Android unverified bug

Most helpful comment

@Codelisk that wasn't meant as a workaround, but as a way for us to fix it in our code

All 8 comments

It would be perfect when there would be a BindableProperty OffColor to set for Switch.

updating the default theme is also an option

@StephaneDelcroix i miss something, you mean making a custom renderer for the switch control on each platform?
Otherwise do you have any info for me how to "update the default theme"?

@Codelisk that wasn't meant as a workaround, but as a way for us to fix it in our code

Same thing here as on the other two issues @transis2

I think there's something I'm not understanding here on your set of issues.

image

@PureWeen sorry for missunderstood.
Now it's more like a fature request than a bug.

In My case I wrote projects in 2017 and keeping it until the actual days.
I wrote custom theme resources because in the past we have no native support to dark theme.
Also there's something wrong with My \Resources\values\styles.xml

My app give users the option to choose light or dark Mode independent of OS theme. This the cause of confusion (test was done using light OS theme) .
If we just change page background color to dark, controls need be set manually to inverse color.

But some controls haven't exposed color properties that led me to write an issue.

For example: switch don't expose an property to manually colorize offcolor.

@transis2 I think then the idea would be rather to add an OffColor property to Switch? https://github.com/xamarin/Xamarin.Forms/issues/10341

@jsuarezruiz Yes, it's a enhancement like the proposed by https://github.com/xamarin/Xamarin.Forms/issues/10341

Was this page helpful?
0 / 5 - 0 ratings