Just implementing a switch into a display which has a black background on Android.
Added a Switch managed to set OnColor and ThumbColor for On State and Thumbcolor for Off State, but no matter were I tinker I can not set the Oncolor for the off state using visual state manager (hope that makes sense).
As you can see in the image below, the on State is green, the off state shows nothing it melds into the black background. I want to set that as grey.
My Switch
<Switch IsToggled="True" Style="{StaticResource ToggleSwitch}">
In My Styles.xaml I have added my custom style.
<Style x:Key ="ToggleSwitch" TargetType="Switch">
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="On">
<VisualState.Setters>
<Setter Property="OnColor"
Value="Green" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Off">
<VisualState.Setters>
<Setter Property="OnColor"
Value="Gray" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
I have seen other answers suggesting changing Background and Backgroundcolor, this is not the answer as the background has to be black. No matter what I try I can not change the off state color at all.
Any suggestions/pointers as always appreciated.
Reference: .NET MAUI: Change off color of switch <-- This answer is no good at all.
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/switch#switch-visual-states
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/visual-states
contemplating using a custom solution at this rate :- https://github.com/IeuanWalker/Maui.Switch
But would much rather use native or as near as possible to native.
Thanks in Advance.

This is because natively Switch only has
OnColorProperty which can only get or set the color of the switch when it is in theOnposition. So it would be perfect when there would be a BindablePropertyOffColorto set for Switch.However, you can raise a feature request:https://github.com/dotnet/maui/issues/new/choose for adding a BindableProperty
OffColorto set for Switch.As an alternative workaround, you can use the custom solution as you mentioned:https://github.com/IeuanWalker/Maui.Switch. I checked the sample code, you can change the Off state color via
CustomSwitch_SwitchPanUpdatemethod:Output which has a black background: