maui icon indicating copy to clipboard operation
maui copied to clipboard

Switch control not shows thumb color properly in the Windows when initially its state is off.

Open divyesh008 opened this issue 6 months ago • 1 comments

Description

I have used the Switch control in my page like this:

 <HorizontalStackLayout Margin="{OnPlatform Android='0,15,0,0', iOS='0,25,0,20'}" Spacing="20">
    <Switch
        HorizontalOptions="Start"
        IsToggled="{Binding CorrectOnSite}"
        OnColor="{StaticResource MidGray}"
        ThumbColor="{StaticResource WhiteSmoke}" />
    <Label
        Style="{StaticResource DisplayFieldFieldTextStyle}"
        Text="Corrected onsite"
        VerticalOptions="Center"
        VerticalTextAlignment="Center" />
</HorizontalStackLayout>

When I run the app in the Windows device, it shows output like this:

https://github.com/user-attachments/assets/70b011a0-36bc-434a-8c78-4ea95cacaf1d

As you can see in the recording it does not show ThumbColor at all when its off initially, if I toggle the switch from off to on and vice versa than only it shows ThumbColor.

Steps to Reproduce

  1. Add a Switch control and set IsToggled to False initially.
  2. Set OnColor and ThumbColor values.
  3. Run the app in Windows.
  4. Notice the Switch control appearance.

Link to public reproduction project repository

https://github.com/divyesh008/Editor_bug/blob/main/poc_maui/Views/MainPage.xaml

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms, No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows SDK 10.0.17134.0

Did you find any workaround?

No

Relevant log output

No response

divyesh008 avatar Aug 08 '24 18:08 divyesh008