Skip to main content

Applying a Modified Theme to a WPF Application

Note

The WPF Theme Editor does not support the DevExpress WPF Controls 18.2 or later. Use the WPF Theme Designer tool instead.

This tutorial demonstrates how to apply a theme modified via the Theme Editor to a WPF application. Use the theme you have created in the previous lesson.

To apply this theme to an application, follow the steps below.

  1. Run Visual Studio and open a WPF solution to which you wish to apply the theme.
  2. Add a reference to the theme assembly in this solution. To do this, right-click References in the Solution Explorer and select Add Reference. In the Browse tab, locate the following assembly:

    C:\Program Files (x86)\DevExpress 18.2\Components\Sources\DevExpress.Xpf.Themes\DevExpress.Xpf.Themes.NewTheme\Bin\DevExpress.Xpf.Themes.NewTheme.v18.1.dll

    GettingStarted_AddReference

  3. Add the following code to the MainWindow constructor.

    using DevExpress.Xpf.Core;
    //...
    public partial class MainWindow : Window {
        public MainWindow() {
            Theme theme = new Theme("NewTheme", "DevExpress.Xpf.Themes.NewTheme.v18.1");
            theme.AssemblyName = "DevExpress.Xpf.Themes.NewTheme.v18.1";
            Theme.RegisterTheme(theme);
            ThemeManager.SetTheme(this, theme);
            InitializeComponent();
        }
    }
    
  4. Run the application to view the result.