Skip to main content
All docs

Preload Theme Resources

  • 3 minutes to read

Controls use theme resources (default styles, templates, keys) to change their appearance when you apply a DevExpress WPF Theme to the application.

A WPF application loads a control’s theme resources only when the control is about to be displayed. As a result, windows that rely on DevExpress WPF themes can take longer to appear.

This prolonged display time can be crucial when the first window of your application is lightweight (for example, a login form), and the main application window is heavy (it contains a large control or many controls). In this case, the first window appears quickly, but the second one can take a noticeable amount of time to load theme resources.

The PreloadThemeResource and PreloadThemeResourceAsync methods allow you to speed up the display time of subsequent windows. These methods preload theme resources for the control assemblies that are referenced on these windows.

Refer to the following methods’ remarks for more information: PreloadThemeResource / PreloadThemeResourceAsync.

Asynchronous Theme Resource Preload

How to Use

Asynchronous theme preload works best when the application’s start window is lightweight, like a login form. In this case, you can use the PreloadThemeResourceAsync method to preload theme resources of the second window asynchronously while a user inputs login credentials.


The following code sample creates static constructors and preloads the Office2019Colorful theme resources asynchronously at the application startup.

using System.Windows;
using System.Threading;
using DevExpress.Xpf.Core;

public partial class App : Application {
    protected async override void OnStartup(StartupEventArgs e) {
        await ThemeManager.PreloadThemeResourceAsync("Office2019Colorful");


Asynchronous theme resource preload may slow down resource loading from the UI thread. Refer to the following section to avoid this shortcoming: Use Asynchronous Theme Preload on Dispatcher.

Synchronous Theme Resource Preload

When to Use

This technique works best when you display the Splashscreen Manager at the application startup. In this case, the method loads a control’s theme resources while a splashscreen is displayed.


Theme preload slows down application startup but speeds up startup of subsequent windows that use preloaded theme resources.


Call the PreloadThemeResource method to preload theme resources synchronously.

The following code sample preloads Data Grid and LayoutControl assemblies while the Splashscreen Manager is displayed:

using DevExpress.Xpf.Core;
using DevExpress.Xpf.Grid;
using DevExpress.Xpf.LayoutControl;
using System;
using System.Windows;

public partial class App : Application {
    static Type[] types;
    static App() {
        types = new Type[] { typeof(GridControl), typeof(LayoutControl) };

View Example: Synchronously Preload WPF Themes Within Splashscreen