wpf 如何将自定义样式应用到 AvalonDock

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15221907/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 07:53:13  来源:igfitidea点击:

How to apply custom style to AvalonDock

wpfavalondock

提问by ceco

Does anyone know how I can change the font properties of a title for LayoutAnchorable and LayoutDocument in AvalonDock 2.0? I would like to be able to apply a style that is used everywhere in my WPF application for consistency.

有谁知道如何在 AvalonDock 2.0 中更改 LayoutAnchorable 和 LayoutDocument 标题的字体属性?我希望能够应用在我的 WPF 应用程序中随处使用的样式以保持一致性。

回答by MrDosu

You can create a theme to use across your application. There are a couple of themes available in the AvalonDock distribution that can be used as an example or template to create your own (e.g. VS2010 theme).

您可以创建一个主题以在您的应用程序中使用。AvalonDock 发行版中有几个可用的主题,可以用作示例或模板来创建您自己的主题(例如VS2010 主题)。

You then just apply it to your DockingManager:

然后你只需将它应用到你的 DockingManager:

<dock:DockingManager x:Name="dockingManager"
                     AnchorablesSource="{Binding DockModel.Tools}"
                     DocumentsSource="{Binding DockModel.Documents}"
                     ActiveContent="{Binding DockModel.ActiveContent, Mode=TwoWay}">

  <dock:DockingManager.Theme>
     <adCustom:DarkBlossomTheme />
  </dock:DockingManager.Theme>
  <dock:LayoutRoot/>
</dock:DockingManager>