Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I not specify a theme for WPF and use the host OS theme?

Tags:

wpf

Is there a way to not specify a theme at all for WPF and just let it default to what the OS is using? I am still partial to Winforms for this reason. WinForm apps feel professional, light on its feet and part of the operating system, whereas as WPF application, including VS 2010, feel heavy. Moreover, WPF applications are visually inconsistent. They are like web pages where every developer decides what size a controls should be rather than leaving it up to the user and the operating system. I prefer to follow guidelines.

like image 481
ATL_DEV Avatar asked Oct 20 '10 01:10

ATL_DEV


1 Answers

By default, WPF will query the system settings to determine which Windows theme has been selected. It will then use a WPF theme which should closely match that of the system. This will provide styles for properties such as colors, and templates for the overall look (including animations). The WPF themes include styles for all the built in controls.

Keep in mind, unlike WinForms, WPF controls are all created in WPF. In WinForms, most of the controls were created using pInvoke and come from non-managed code.

WinForms could guarantee the same look as the OS, because the control was coming from the OS. While this was a nice side-effect, the down-side was that you were limited in your ability to interact with, extend, or modify the controls look.

Built in WPF themes designed to match windows themes include:

Windows Vista: themes\Aero.NormalColor.xaml
Windows XP: themes\Luna.NormalColor.xaml
Olive Green Windows XP: themes\Luna.Homestead.xaml
Silver Windows XP: themes\Luna.Metallic.xaml
Windows XP Media Center Edition 2005 and XP Tablet PC Edition 2005: themes\Royale.NormalColor.xaml
Windows Classic: themes\Classic.xaml
like image 161
mbursill Avatar answered Sep 27 '22 18:09

mbursill