0

标题差不多。catel:TabControl 的背景是白色的,无论 MahApps 的主题是什么。

我不知道它是否是唯一一个这样做的 Catel 控件,因为我没有测试它们中的每一个。

但是,它不会受到 MahApps 选择的主题(BaseDark 或 BaseLight)的影响。自从我开始使用浅色时,这并不明显,所以 TabControl 正如预期的那样是白色的,但是一旦我切换到深色主题,它仍然是白色的。

4

1 回答 1

2

This problem is already solved in Orchestra (https://github.com/WildGums/Orchestra).

I think you should override the Catel's tab control style like following: <windows:MetroDataWindow.Resources> <ResourceDictionary> <Style TargetType="catel:TabControl" BasedOn="{StaticResource {x:Type TabControl}}" /> </ResourceDictionary> </windows:MetroDataWindow.Resources>

You can check the example in the Orchestra.Shell.MahApps project in Orchestra:

Points of interest:

  • Orchestra.Examples.MahApps/Orchestra.Examples.MahApps.Shared/Views/MainView.xaml

  • Orchestra.Shell/Orchestra.Shell.MahApps/Orchestra.Shell.MahApps.Shared/Views/ShellWindow.xaml

To enable dark MahApps theme in Orchestra you should add the following code to Orchestra.Shell/Orchestra.Shell.MahApps/Orchestra.Shell.MahApps.Shared/Themes/Generic.xaml <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />

Please let me know if this helps.

于 2015-08-16T19:53:08.593 回答