dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.06k stars 1.73k forks source link

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

Open divyesh008 opened 2 months ago

divyesh008 commented 2 months ago

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

github-actions[bot] commented 2 months ago

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.