locked
How to modify the color of a ToggleSwitch? RRS feed

  • Question

  • I have a ToggleSwitch,

    when its status is "ON" then the rectangle color becomes of the same color of the Windows 8 theme chosen by the user!

    I simply would like to change that color, replacing it with my App color.

    Is it possible?


    Lovo Apps

    Saturday, June 30, 2012 3:11 PM

Answers

  • Easiest way is to provide your own theme brushes in App.Xaml resource dictionary. There are a lot of theme brushes defined for ToggleSwitch. The ones you need to change for the purple color are:
                <SolidColorBrush x:Key="ToggleSwitchCurtainBackgroundThemeBrush" Color="put your own color here" />
                <SolidColorBrush x:Key="ToggleSwitchCurtainPointerOverBackgroundThemeBrush" Color="put your own color here" />
                <SolidColorBrush x:Key="ToggleSwitchCurtainPressedBackgroundThemeBrush" Color="put your own color here" />

    Hope this helps!

    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

    Sunday, July 1, 2012 6:07 PM

All replies

  • Easiest way is to provide your own theme brushes in App.Xaml resource dictionary. There are a lot of theme brushes defined for ToggleSwitch. The ones you need to change for the purple color are:
                <SolidColorBrush x:Key="ToggleSwitchCurtainBackgroundThemeBrush" Color="put your own color here" />
                <SolidColorBrush x:Key="ToggleSwitchCurtainPointerOverBackgroundThemeBrush" Color="put your own color here" />
                <SolidColorBrush x:Key="ToggleSwitchCurtainPressedBackgroundThemeBrush" Color="put your own color here" />

    Hope this helps!

    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

    Sunday, July 1, 2012 6:07 PM
  • Easiest way is to provide your own theme brushes in App.Xaml resource dictionary. There are a lot of theme brushes defined for ToggleSwitch. The ones you need to change for the purple color are:
                <SolidColorBrush x:Key="ToggleSwitchCurtainBackgroundThemeBrush" Color="put your own color here" />
                <SolidColorBrush x:Key="ToggleSwitchCurtainPointerOverBackgroundThemeBrush" Color="put your own color here" />
                <SolidColorBrush x:Key="ToggleSwitchCurtainPressedBackgroundThemeBrush" Color="put your own color here" />

    Hope this helps!

    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

    Thank you Mark,

    alternatively I edited the button Style and I found the "SwitchCurtain" Rectangle, and simply I changed its "Fill" property.

    Initially I was editing the Style but my eyes didn't want to see that SwitchCurtain Rectangle.


    Lovo Apps

    Thursday, July 5, 2012 10:11 AM
  • Thank You Mark, Would you please tell me how to change selected item highlight color in the ComboBox?

     
    Wednesday, July 25, 2012 2:22 PM