Skip to main content
All docs
V24.1

ApplicationThemeHelper.PreloadAsync<T>() Method

Asynchronously preloads theme resources for the view specified by the UserControl.

Namespace: DevExpress.Xpf.Core

Assembly: DevExpress.Data.Desktop.v24.1.dll

NuGet Packages: DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design

Declaration

public static Task PreloadAsync<T>()
    where T : UserControl, new()

Type Parameters

Name Description
T

A UserControl or its descendant.

Returns

Type Description
Task

A task that allows you to asynchronously preload theme resources.

Remarks

Note

The PreloadAsync method allows you to preload lightweight theme resources only. Use the PreloadThemeResourceAsync method instead to asynchronously preload regular theme resources.

The following code sample asynchronously preloads resources for the MyControl:

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

public partial class App : Application {
    static App() {
        CompatibilitySettings.UseLightweightThemes = true;
    }
    protected override async void OnStartup(StartupEventArgs e) {
        base.OnStartup(e);
        await ApplicationThemeHelper.PreloadAsync<MyControl>();
    }
}

Refer to the following help topic for more information: Preload Theme Resources.

See Also