Tomasz
Tomasz

Reputation: 2061

DevExpress 15.1 WPF - Apply custom theme

I have trouble with applying custom theme to DevExpress 15.1 WPF application.

I have done steps:

The result is exception:

An exception of type 'System.Reflection.TargetInvocationException' occurred in System.Xaml.dll but was not handled in user code

Additional information: Exception has been thrown by the target of an invocation

with inner exception

{"Object reference not set to an instance of an object."}

at DevExpress.Xpf.Core.ThemedElementsDictionary.GetAssemblyFullName(Object key)
at DevExpress.Xpf.Core.ThemedElementsDictionary.RegisterThemeType(String themeName, String fullName, Object key)

Do you have idea what I'm doing wrong? Maybe it has changed in 15.1?

Upvotes: 1

Views: 1143

Answers (1)

Kurt Moan
Kurt Moan

Reputation: 11

You are pretty close.

I added the following code to the OnStartup method of the App.xaml.cs:

var myTheme = new Theme("Dark", "DevExpress.Xpf.Themes.Dark")
{
    AssemblyName = "DevExpress.Xpf.Themes.Dark.v15.1"
};
Theme.RegisterTheme(myTheme);
ThemeManager.ApplicationThemeName = myTheme.Name;

Upvotes: 1

Related Questions