Change the style of an existing theme (AvalonDock)

I want to change the color of the Metro AvalonDock theme. I also asked a related question with Codeplex , but so far I have not had an answer.

I have identified the following XAML ( source file ) as the part that I think 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 BaseColor3 (blue by default).

Now I have changed the color in my XAML:

 <Window.Resources> ... <SolidColorBrush x:Key="AvalonDock_ThemeMetroBaseColor3" Color="Red" /> </Window.Resources> 

Nothing changes. The color remains bluish. Now I am confused. Thus, it must be the wrong property to change, or something to prevent color change and / or internal, it uses the old value or something like that.

Why doesn't it work? How can I detect such problems and fix this?

+5
source share
1 answer

I think the problem is this:

 <avalon:DockingManager> <avalon:DockingManager.Theme> <avalon:MetroTheme /> </avalon:DockingManager.Theme> ... </avalon:DockingManager> 

I deleted the theme setting and created my own resource dictionary (I copied the style from the AvalonDock source). I had to fix some errors:

  • BaseColorXX not found → copy of VS2010 theme of an older version of AvalonDock
  • TargetType 'HwndHostInstance' does not match the element type "LayoutAutoHideWindowControl → comment out the style with x: Key =" {x: Type avalonDockControls: LayoutAutoHideWindowControl} ")
  • Delete BasedOn="{Static Resource {x:Type MenuItem}}" (caused an error)
  • Change image paths to my own project path using copied images

After that he worked.

+7
source

Source: https://habr.com/ru/post/1202064/


All Articles