1
votes

I am playing around with overwriting the system colors to change the color look of my application. The new system colors are defined in a separate resource dictionary like this:

<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#FF2D2D2D" />

and the file gets loaded properly. But the appearance of the controls is different if I switch the theme of the operating system (Windows 7) between "aero" and "classic". E.g. for "classic" the main part of the application appears in a dark grey color (the color of the ControlBrushKey) (see first figure). But when I start the application when "aero" is active, most of the application still has the "neutral" aero look (second figure). Why ist that? I expected the different SystemColors to be used in the same way, no matter what theme is selected.

Windows theme "classic"

Windows theme "aero"

Is changing the system colors a good idea? Or would you recommend other solutions?

1
Best guess is that the templates of the controls in the aero theme use different brushes. this makes sense if you want to use both themes at the same time throughout your application. Since you are already aware of which brush it uses, overriding the brush for the aero theme should not be that difficult. - Timothy Groote
Problem is that I am not aware which brushes are actually used by the aero theme. I modified all the colors of SystemColors to a dark color, but it made no difference. How do I find out which brushes are used and how do I replace them? - tabina

1 Answers

1
votes

Problem is that I am not aware which brushes are actually used by the aero theme. I modified all the colors of SystemColors to a dark color, but it made no difference. How do I find out which brushes are used and how do I replace them?

You could take a look at how the default templates are defined. Download dotPeek or some other .NET decompiler and decompile the PresentationFramework.* assemblies in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\.

You will find the decompiled BAML resources under Resources->PresentationFramework.*.g.resources->themes.