If you write your own WPF custom controls, you are probably aware of how to go about adding theming support for the various Windows themes. One of the more popular themes introduced in Windows Vista, and continued over to Windows 7, was the Aero theme. This is all fine and dandy if your WPF custom controls are used in applications that only run on Vista and Windows 7, but what happens when you try to use them on Windows 8? Well, I’ll tell you… no Aero theme will be applied. Why? The Aero theme was removed from Windows 8. That’s right, no more drop shadows, and no more glass window chrome effects.
So what now? Luckily, there is still a way to provide theming support for Windows 8. It’s just difficult to figure out because it is not documented yet. Go figure! I am sure you are aware of the naming convention for themes. Just in case you forgot it goes a little something like this.
Themes<Theme Name>.<Theme Color>.xaml
“Themes” is of course the subfolder where your theme files are located within your control assembly. “<Theme Name>” refers to the name of the theme. For example; Aero. “<Theme Color>” is the color of the theme. For example; NormalColor. Here is a list of supported themes.
File Name | Windows Theme |
Classic.xaml | Classic Windows 9x/2000 look on Windows XP |
Luna.NormalColor.xaml | Default blue theme on Windows XP |
Luna.Homestead.xaml | Olive theme on Windows XP |
Luna.Metallic.xaml | Silver theme on Windows XP |
Royal.NormalColor.xaml | Default theme on Windows XP Media Center Edition |
Aero.NormalColor.xaml | Default theme on Windows Vista/Windows 7 |
That’s good to know, but what about Windows 8? Excellent question! In order to provide theming support for Windows 8 you need to name your theme file as follows.
Aero2.NormalColor.xaml
You can see it here in the solution explorer.
Wait… That’s it? Just add a number “2” after “Aero”? Yup, that’s it. Honestly, I’m not really sure why they decided on Aero2.NormalColor.xaml. The fact that the Aero theme is gone from Windows 8 makes me think that there should have been a new name all together. My guess is that this all occurred during the messy “Metro” naming fiasco, so they just decided to choose something. To Microsoft’s credit, Most of the Aero features are still in Windows 8. Such as the windows pinning, shake, and peek features. Really, the only thing that was really dropped were the visual aspects (glass window chrome and drop shadows) in favor of their new Microsoft Design Style (aka Metro).
One more question Brian. What happens if Windows 8 doesn’t find this new Aero2.NormalColor.xaml file? The answer to that is simple. It next looks for a Classic.xaml, and if it can’t find that theme file, then falls back to the Generic.xaml.
I hope that clears up some confusion on adding support for Windows 8 to your custom control library. Feel free contact me on my blog, connect with me on Twitter (@brianlagunas), or leave a comment below for any questions or comments you may have.
Thanks very much, Brian. Exactly what I was looking for.
I’ve got an application framework that mimics the views found in the Windows File Explorer. It turns out that the formatting is subtly different (different image sizes, squared-off highlights, spacing, etc.), so we definitely need another XAML file to make the application look Windows 8ish.
You’re welcome. I’m glad you found this post helpful.