Reputation: 989
I want to change the Metro theme color of AvalonDock. I also asked a related question on Codeplex but I didn't got an answer so far.
I identified the following XAML (source file) as the piece that, I guess, is responsible for the color I want to change:
<Style TargetType="avalonDockControls:AnchorablePaneTitle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
...
<ControlTemplate.Triggers>
...
<DataTrigger Binding="{Binding Model.IsActive, RelativeSource={RelativeSource Mode=Self}}" Value="True">
<!-- following XAML line -->
<Setter Property="BorderBrush" Value="{DynamicResource AvalonDock_ThemeMetro_BaseColor3}" />
<Setter Property="BorderThickness" Value="0,3,0,0"/>
</DataTrigger>
...
</ControlTemplate.Triggers>
...
You can see: the brush gets the BaseColor3 (a bluish color by default).
Now I changed the color like that in my XAML:
<Window.Resources>
...
<SolidColorBrush x:Key="AvalonDock_ThemeMetroBaseColor3" Color="Red" />
</Window.Resources>
Nothing changes. The color stay bluish. Now I am confused. So it must be the wrong property to change or something prevents the color to change or/and internal it uses the old value or something...
Why is it not working? How can I discover such problems and fix it?
Upvotes: 6
Views: 8798
Reputation: 1020
The solution seems to be adding the SolidColorBrush to the DockingManager resources in the xaml file.
<avalonDock:DockingManager Grid.Row="1" x:Name="DockingManager">
<avalonDock:DockingManager.Resources>
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor1" Color="Red"/>
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor3" Color="Red"/>
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor4" Color="Red"/>
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor5" Color="Red"/>
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor8" Color="Red"/>
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor9" Color="Red"/>
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor10" Color="Red"/>
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor11" Color="Red" />
<SolidColorBrush x:Key="AvalonDock_Expression_BaseColor13" Color="Red"/>
</avalonDock:DockingManager.Resources>
<avalonDock:DockingManager.Theme>
<avalonDock:ExpressionDarkTheme/>
</avalonDock:DockingManager.Theme>
Upvotes: 1
Reputation: 989
I guess the problem was this:
<avalon:DockingManager>
<avalon:DockingManager.Theme>
<avalon:MetroTheme />
</avalon:DockingManager.Theme>
...
</avalon:DockingManager>
I removed the theme setting and created an own Resource dictionary (copied the style from the AvalonDock source). I had to fix some errors:
BasedOn="{Static Resource {x:Type MenuItem}}"
(caused an error)After that it worked.
Upvotes: 7