# WPF windows don't cooperate with unofficial themes

A while ago, I decided to patch my uxtheme.dll (using the Universal Theme Patcher) to allow for use of unofficial window themes. The problem is that WPF applications seem to ignore the custom theme for native Windows controls (such as scrollbars and buttons) and instead use the classic theme for them.

I first noticed this with Visual Studio 2010:

I thought it was a bug in the program itself, but creating my own WPF application gives the same result:

Googling reveals that I'm not the only person with this issue, but I haven't found a solution.

Is there anything I can do about it? Should I try a different uxtheme.dll patcher? Or is this what I get for trying to [gasp] customize Windows?

• so that’s the reason. trying to make windows a bit prettier makes wpf apps uglier -.- well, going back to aero after using soft7 isn’t possible (i tried, but i think i puked a little into my mouth ;)) so i’ll have to live with it. Dec 19, 2011 at 10:26
• @flyingsheep: Yep, that's what it comes down to. Fortunately for me, the only WPF application I use regularly is Visual Studio, and the impact is really minimal in it, so I hardly notice it. On a larger scale, though, with lots of WPF apps, I imaging it would get really annoying. Dec 20, 2011 at 8:55

Currently there isn't anything you can do about it. WPF applications have their own theme [which isn't coupled with Windows' theme]. The best thing I could suggest is that you write an app or create your own dll that makes the WPF theme change to the one you like, you'd get a lot of recognition for that ;)

• Hmm, that's really interesting, I didn't know that. I'll see what I can do. :) Aug 2, 2010 at 23:51
• Confirmed. WPF contains a version of each built-in Windows theme translated to XAML. I'm not sure why in the hell they would do something like that (I guess so you could override system styles?), but there isn't much I can do about it. You could theoretically write an application that takes the .theme file of the custom theme you're using and translates it into a WPF theme, then injects it into WPF so that it loads the newly-created theme; but this is a lot of work--much more than I'm willing to put into it, unfortunately. Looks like I'll have to deal with crappy-looking scrollbars. :( Aug 5, 2010 at 4:44
• I think as long as you are not using WinXP, Vista Basic or 7 Basic your bars and buttons, if not styled, will look rather ok Aug 5, 2010 at 5:23
• Yeah but imagine someone using a dark-colored theme. Silver scrollbars and buttons would look really out of place. :/ Dec 16, 2010 at 23:42

There IS a good workaround for this problem. The following procedure will tell WPF to use the windows vista/7 theme instead of windows basic (for the controls).

The reason that using a new theme causes these problems is that wpf figures out what theme is set by checking the file name of the currently activated visual style. If the name is "aero.msstyles", it uses the aero theme. If it is "luna.msstyles", it goes one step further and checks the current color scheme to fine tune the colors (NormalColor, Metallic, Homestead are the color schemes for windows xp, Windows vista ditches the color scheme concept entirely in favor of windows aero). There is also a built-in theme in wpf for "royale.msstyles". If the theme file has a name that wpf doesn't recognize, it just uses the windows basic theme instead.

The workaround? Rename your visual style from "{whatever}.msstyles" to "aero.msstyles", then modify its associated ".theme" files in notepad to account for the new name (note that now you can only apply the visual style with a theme file). WPF now shows the windows vista style instead of windows basic ;-).

• This is a good workaround, definitely, but it doesn't solve the core issue. Say I used a dark theme--the default Aero controls would look really out of place. But either way, great find! Thanks! Apr 23, 2012 at 1:19

I also asked this question some time ago and couldn't find any answers.

https://stackoverflow.com/questions/7495906/visual-studio-2010-classic-system-theme

The only theme that Visual Studio 2010 supports is the default aero theme. Al tough I noticed that some themes do support it, but most don't.

I tried all things, basically, Running VS2010 as Administrator, running it in compatibility mode, installing/uninstalling SP1 etc.

We must abide by Microsoft's rules :P

• It makes sense that Visual Studio would not aupport custom themes, in theory that is up to the programmer to support and provide, Window's XP introduce a really weird problem for programmers "having to support" a custom theme and not having a great deal number of tools to do so. Jan 31, 2012 at 18:16

plz excuse, I didn't have enough 'points' to comment or clarify from the context of AlexKven's answer

Just wanted to add, for those interested…

in the *.theme file, you must specify aero.msstyles in Titlecase. so it should read something like Path=%ResourceDir%\themes\path\to\Aero.msstyles as opposed to ...\aero.msstyles.