-1

In my DefaultTheme.xaml File I have only set my colors

<SolidColorBrush x:Key="CheckboxForegroundColor"                Color="Black"/>
    <SolidColorBrush x:Key="CheckboxBackgroundColor"                Color="{DynamicResource {x:Static SystemColors.WindowColorKey}}"/>
    <SolidColorBrush x:Key="CheckboxBorderbrushColor"               Color="{DynamicResource {x:Static SystemColors.WindowColorKey}}"/>

In my ColorTheme.xaml I have done the same but different colors

   <SolidColorBrush x:Key="CheckboxForegroundColor"                Color="#FFFFFFFF"/>
     <SolidColorBrush x:Key="CheckboxBackgroundColor"                Color="#FF2d2d30"/>
<SolidColorBrush x:Key="CheckboxBorderbrushColor"               Color="#FFCC1517"/>

In my App.xaml

<Setter Property="Foreground"               Value="{DynamicResource CheckboxForegroundColor}" />
                    <Setter Property="Background"               Value="{DynamicResource CheckboxBackgroundColor}" />
                    <Setter Property="BorderBrush"              Value="{DynamicResource CheckboxBorderbrushColor}"/>

Changing themes at runtime works fine and my ColorTheme works fine also. But my question is how do I know which systemcolors to use for example Button.Foreground and Button.Background to get the windows Classic look? There are so many Systemcolors I get confused and don't know which one to use for different controls. I have set all my colors to WindowsColorKey in my Default.xaml but seems that it is the wrong way to do it because my application becomes white.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
A.Game
  • 49
  • 6
  • 1
    I wouldn't redesign the wheel - if you want the classic theme, it is already available... http://stackoverflow.com/questions/2075720/windows-7-theme-for-wpf . If you want to view the brushes used, you may have them installed locally... http://stackoverflow.com/questions/1453853/where-to-find-wpf-classic-theme-as-xaml – Mark W Nov 29 '16 at 20:54

1 Answers1

0

You can make a function to reset the colors of your Checkbox's... Something like:

public void DefaultColors()
{
    cbBox1.ForeColor = Color.Beige;
    cbBox2.ForeColor = Color.Beige;
    //And so on....
}

And run it when you need to. The object's you create in your .XAML are accessible in the affiliated .cs file. Do it there...

Uchiha Itachi
  • 1,251
  • 1
  • 16
  • 42
  • Why no make it simple and change all my colors to default in my DefaultTheme and then when i change my theme everything changes? Just like i have done with my ColorTheme? Is there no way to set my colors to default in the DefaultTheme.xaml to have that classic window look? – A.Game Nov 29 '16 at 20:53
  • Create the function to assign the colors, then when you initialize the window, run the function. If you want to change the colors at runtime to a different theme, you have to have a function like that anyway. It's not complicated - just repetitive. – Uchiha Itachi Nov 29 '16 at 20:58
  • Trust me... I've done it... https://github.com/geoffoverfield/MyCalculator/blob/master/Calculator2.7.2/Calculator/Form1.cs – Uchiha Itachi Nov 29 '16 at 21:02
  • Guess that's not helpful @A.Game?? – Uchiha Itachi Nov 29 '16 at 21:27