The requested page is not available for the requested platform. You are viewing the content for Default platform.

Applying a Modified Theme to a WPF Application

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.1\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 and see the result.