Back to Devexpress

Theme.RegisterTheme(Theme) Method

wpf-devexpress-dot-xpf-dot-core-dot-theme-dot-registertheme-x28-devexpress-dot-xpf-dot-core-dot-theme-x29.md

latest4.0 KB
Original Source

Theme.RegisterTheme(Theme) Method

Registers the specified theme in the ThemeManager.

Namespace : DevExpress.Xpf.Core

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public static void RegisterTheme(
    Theme theme
)
vb
Public Shared Sub RegisterTheme(
    theme As Theme
)

Parameters

NameTypeDescription
themeTheme

A String that specifies the theme name.

|

Remarks

To be able to apply a newly created theme to a WPF application, you should register it using the static RegisterTheme method. To apply a theme, use the static ThemeManager.SetTheme method.

To unregister a particular theme, use the static Theme.RemoveTheme method.

To unregister all manually registered themes, use the static Theme.RemoveAllCustomThemes method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the RegisterTheme(Theme) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-create-a-fluent-design-using-appearance-options/CS/FluentDesignTemplate/App.xaml.cs#L35

csharp
var customtheme = Theme.CreateTheme(custompalette, Theme.Office2019Black);
Theme.RegisterTheme(customtheme);
ApplicationThemeHelper.ApplicationThemeName = customtheme.Name;

wpf-mvvm-behaviors-gallery-based-theme-palette-selector/CS/App.xaml.cs#L13

csharp
var customTheme = Theme.CreateTheme(customPalette, Theme.Office2016ColorfulSE);
    Theme.RegisterTheme(customTheme);
}

wpf-create-a-fluent-design-using-appearance-options/VB/FluentDesignTemplate/App.xaml.vb#L30

vb
Dim customtheme = Theme.CreateTheme(custompalette, Theme.Office2019Black)
Theme.RegisterTheme(customtheme)
ApplicationThemeHelper.ApplicationThemeName = customtheme.Name

wpf-mvvm-behaviors-gallery-based-theme-palette-selector/VB/App.xaml.vb#L15

vb
Dim customTheme = Theme.CreateTheme(customPalette, Theme.Office2016ColorfulSE)
    Theme.RegisterTheme(customTheme)
End Sub

See Also

RemoveTheme(String)

RemoveAllCustomThemes()

Theme Class

Theme Members

DevExpress.Xpf.Core Namespace