.NET MAUI Windows Switch (ToggleSwitch) shows white background for disabled OFF state and hover OFF state
05:40 04 Jun 2026

I am working with .NET MAUI on Windows (WinUI) and using the default Switch, which maps to ToggleSwitch.

I am trying to achieve consistent styling for different switch states, but I am facing issues where the control falls back to white background unexpectedly.

It seems like Visual States are not being applied correctly in certain scenarios. The default colors applying instead of my visual state colors.

Problem

Case 1:

Expected:

  • Light gray (disabled OFF state)

Actual:

  • White / washed out background

Case 2:

On hover (PointerOver):

Expected:

  • Slightly darker gray (hover effect)

Actual:

  • White background appears on hover

Attempted but failed

public class CustomSwitchHandler : SwitchHandler
{
    protected override void ConnectHandler(ToggleSwitch platformView)
    {
        base.ConnectHandler(platformView);

        platformView.Resources["ToggleSwitchFillOff"] =
            new SolidColorBrush(Colors.Gray);

        platformView.Resources["ToggleSwitchFillOffPointerOver"] =
            new SolidColorBrush(Colors.DarkGray);

        platformView.Resources["ToggleSwitchFillOffDisabled"] =
            new SolidColorBrush(Colors.LightGray);
    }
}

Why does the ToggleSwitch show white background for:

  • IsEnabled = false, IsToggled = false

  • Hover (PointerOver) when IsToggled = false

    Expected Result

    1. OFF (enabled) → gray

    2. OFF (hover) → darker gray (no white)

    3. OFF (disabled) → light gray (no white/fading)

How to achieve the expected result?

c# .net maui maui-windows