Back to Devexpress

Theme.CreateTheme(Win10Palette) Method

wpf-devexpress-dot-xpf-dot-core-dot-theme-dot-createtheme-x28-devexpress-dot-xpf-dot-core-dot-win10palette-x29.md

latest2.1 KB
Original Source

Theme.CreateTheme(Win10Palette) Method

Creates a new Theme with a Win10Palette.

Namespace : DevExpress.Xpf.Core

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public static Theme CreateTheme(
    Win10Palette palette
)
vb
Public Shared Function CreateTheme(
    palette As Win10Palette
) As Theme

Parameters

NameTypeDescription
paletteWin10Palette

A Win10Palette instance.

|

Returns

TypeDescription
Theme

The new theme.

|

Example

The code sample below performs the following actions:

  1. Creates a theme based on Win10Dark/Win10Light theme depending on the Windows app mode.
  2. Applies the Windows accent color to the palette.
  3. Applies the theme on application startup.
csharp
protected override void OnStartup(StartupEventArgs e) {
    var palette = new Win10Palette(true);
    var theme = Theme.CreateTheme(palette);
    Theme.RegisterTheme(theme);
    ApplicationThemeHelper.ApplicationThemeName = theme.Name;
    base.OnStartup(e);
}
vb
Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
    Dim palette = New Win10Palette(true)
    Dim theme = Theme.CreateTheme(palette)
    Theme.RegisterTheme(theme)
    ApplicationThemeHelper.ApplicationThemeName = theme.Name
    MyBase.OnStartup(e)
End Sub

See Also

Theme Class

Theme Members

DevExpress.Xpf.Core Namespace