Mar312011

WPF and Windows 7 Theme

Published by tom at 6:32 PM under WPF

In WPF, there are a fixed number of “system” themes which mimic the themes from the various favors of the Windows Operating System. The system themes are described on MSDN, where you can also download the default Styles and ControlTemplates applied to the native WPF controls.

Note: The .NET 4 versions of the WPF themes have yet to be released.

One of the system themes is Aero.NormalColor, which is the default theme used when a WPF application is run on Windows Vista or Windows 7. There are two problems with the default Aero theme.

The first issue is that the selected item(s) in a ListBox or TreeView do not get the true Aero “look”. The second issue is that the Aero theme was designed originally for Windows Vista. With Windows 7, some the colors were tweaked while the overall “style” looked the same.win7theme1

ListBox with the default Aero look

This is a far cry from the look seen in the Windows 7 Explorer. The default Aero style for the ListView is closer, but still uses the Windows Vista style colors.

The good thing about WPF though, is that the default Styles and ControlTemplates can be easily customized. In the Windows7Theme1 project, I’ve created Styles for the ListBox, ListView, and TreeView that will give them a look that more closely resembles Windows 7.

win7theme3

The Styles are lacking in a few spots. When using a GridView with the ListView, the column headers need to be updated to match the Windows 7 look. In Windows 7, the TreeView extends the selection the entire length of the control. In addition, the expander buttons fade in and out based on whether the TreeView has the keyboard focus and/or if the mouse is currently hovering.

These updates will have to be a topic for a future blog post though.

Download Sample



[KickIt] [Dzone] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tags: , , , , , , , , , , ,

E-mail | Permalink | Trackback | Post RSSRSS comment feed 0 Responses

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading