Search code examples
xamlwinrt-xamlwinrt-xaml-toolkit

Giving a custom color to a Toggle Switch when it is on mode in xaml?


I want to give a different color to my Toggle Switch when it is On mode.I was going through the Standard Style but couldn't find anything which i am looking for.


Solution

  • First, I'd check the default template again. You can bingoogle it to get this:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj709931.aspx

    You might then want to change the "On" visual state Storyboard to update the Background of the "InnerBorder" element or add another background element and use a DoubleAnimation in the Storyboard to control its Opacity.

    The easiest way to modify the template might be to use Blend. Similar to what I have done in my answer to this question:

    Listview selection display with no padding and no checkmark