Quantcast
Channel: Developer Express Inc.
Viewing all articles
Browse latest Browse all 2370

WPF Themes - Use System Colors and Switch Between Light and Dark App Modes Like Office 2021 (v21.2)

$
0
0

In the latest version of Microsoft Office products, users can select a theme based on system settings. When this theme is used, Office takes Windows Accent Color and App Mode (Light/Dark) settings and applies them to Office itself. If a user changes the Accent Color or App Mode in the OS, Office detects this change and updates the appearance of the application automatically.

With DevExpress WPF Controls v21.2, you can obtain appropriate Windows Accent Color and App Mode (Dark/Light) settings and apply these colors to your application (using our new System Colors theme). If you prefer a Dark application theme, you can use our new Win10Dark theme instead (like any other DevExpress WPF application theme).

System Colors Theme

Just like Microsoft Office, our System Colors theme obtains Windows Accent Color and App Mode (Dark/Light) settings and applies these colors to your application. Our System Colors theme uses palettes to switch colors at run time.

Report Designer - New Expression Button

You can find our System Colors theme in the following theme selectors:

Set the theme selector’s behavior inherited ShowWin10SystemColorTheme property to true to display the theme in the selector.

To apply the Window's Accent Color and App Mode to your application in code-behind, create a Win10Palette instance and pass true to the listenAppModeChangesconstructor parameter. Then, generate a new theme based on the Win10Palette and apply this theme to your application.

var palette = new Win10Palette(true);
var theme = Theme.Create(palette);
Theme.Register(theme);
ApplicationThemeHelper.ThemeName = theme.Name;

You should also reference the Mono.Cecil NuGet package and the DevExpress.Xpf.Core assembly to apply the System Colors theme to your application (either in code behind and from a theme selector).

Windows 10 Dark Theme

As mentioned above, you can also activate the Dark App Mode for your application (based on system settings). To enable this option, we created a new Win10Dark application theme. If you prefer to use the Dark version regardless of user settings, select the Win10Dark theme like any other DevExpress WPF application theme.

Report Designer - New Expression Button

For more information, please refer to our Themes help topic for more information on how to apply a theme to your application.

Your Feedback Matters

As always, we welcome your thoughts. Do you expect to use our new Dark theme? Do you allow end-users to modify theme selection within your application?


Viewing all articles
Browse latest Browse all 2370

Trending Articles