Enable XP/Vista/Windows7 Visual Style for Editor/Wizard in WPF application

Apr 5, 2012 at 9:15 AM

Hi all, I just wanted to share this with you...

If you're building a WPF application and you're using the TaskEditor and/or Wizard, you'll notice that the UI does not look as nice as it should... The visual styles are disabled.

Since you're building a WPF application, there is no "Use XP Visual Styles" in your project properties, nor can you set the EnableVisualStyles() property of Application (since it does not exists).

However this can be solved and the solution is quite simple (once you find out). You can just set the visual style like this in e.g. the constructor of your main window (where InitializeComponent is called):

System.Windows.Forms.Application.EnableVisualStyles();

It's pretty simple, but took me quite some time to find out... So that's why I'm posting this hear now.