Change the Application Theme
- 2 minutes to read
This document describes how to specify the theme of a DevExpress reporting application for WPF.
By default, the DocumentPreviewControl and ReportDesigner control use the Office2016White theme, and the DevExpress.Xpf.Themes.Office2016White.v24.2.dll library has to be deployed to a client machine.
To avoid deploying this assembly with your WPF application, you can switch the default theme to DeepBlue by setting the ApplicationThemeHelper.UseLegacyDefaultTheme property to true at the application startup.
using DevExpress.Xpf.Core;
using System.Windows;
// ...
public partial class App : Application {
protected override void OnStartup(StartupEventArgs e) {
ApplicationThemeHelper.UseLegacyDefaultTheme = true;
base.OnStartup(e);
}
}
To apply another theme to your application, do one of the following.
Specify the theme name in the application constructor using the ApplicationThemeHelper.ApplicationThemeName property as follows.
Use the Smart Tag’s Application Theme feature that applies the selected theme to the entire application at design time and registers it in the App.config file.
To apply the selected theme at runtime, call the ApplicationThemeHelper.UpdateApplicationThemeName method at the application startup.
You can apply a theme to a control’s container (e.g., window). In this case, the specified theme is in effect for all container’s child elements. To accomplish this task, perform the steps described below.
Add the following reference to the application’s Window.
<Window ... xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"> ... </Window>
Set the attached ThemeManager.ThemeName property for the control’s container to the required theme name.
<Window ... dx:ThemeManager.ThemeName="Office2016Black"> ... </Window>
Note that a theme applied to a specific container has a priority over a theme specified at the application level.
For the list of available themes and the corresponding assemblies, see List of DevExpress WPF Themes.