我无法将自定义主题应用于 DevExpress 15.1 WPF 应用程序。
我已经完成了步骤:
- 使用 DevExpress 主题编辑器创建基于 Metropolis Light 的新主题(最新版本)
- 编译它
- 在我的应用程序中添加对已编译 dll 的引用
InitializeComponent()
在我的主窗口中添加这个:Theme theme = new Theme("MyTheme", "DevExpress.Xpf.Themes.MyTheme.v15.1"); theme.AssemblyName = "DevExpress.Xpf.Themes.MyTheme.v15.1"; Theme.RegisterTheme(theme); ThemeManager.SetTheme(this, theme);
结果是异常:
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
除了内部异常
{"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)
你知道我做错了什么吗?也许它在 15.1 中发生了变化?