wpf 如何在 DevExpress 中应用自定义主题?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13063521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to apply custom theme in DevExpress?
提问by kiran
I have created a custom theme using DevExpress theme editor and built the dll file and included it in the resources section.But how can I apply it to the application ??
我已经使用 DevExpress 主题编辑器创建了一个自定义主题并构建了 dll 文件并将其包含在资源部分中。但是我如何将它应用到应用程序中?
回答by DmitryG
The following help topic provided step-by-step instruction on how to apply custom theme to WPF application: How to: Apply a Newly Created Theme to an Application
以下帮助主题提供了有关如何将自定义主题应用于 WPF 应用程序的分步说明: 如何:将新创建的主题应用于应用程序
Related article: WPF Theme Editor
相关文章:WPF 主题编辑器
回答by kmatyaszek
Try this:
尝试这个:
public partial class MainWindow : Window
{
public MainWindow()
{
Theme theme = new Theme("MyCustomTheme", "DevExpress.Xpf.Themes.MyCustomTheme.v12.1");
theme.AssemblyName = "DevExpress.Xpf.Themes.MyCustomTheme.v12.1";
Theme.RegisterTheme(theme);
ThemeManager.SetTheme(this, theme);
InitializeComponent();
}
}
Don't forget add following namespace:
不要忘记添加以下命名空间:
using DevExpress.Xpf.Core;

