How to set theme (colors) in ToolWindowContainer?

Docking/MDI for WPF Forum

Posted 6 years ago by Jared Checkley - Beijer Electronics AB
Version: 13.1.0580
Avatar

How can the theme of the ToolWindowContainer be set, without using the built-in ThemeManager, that affects the whole application?
We want to set the background brush of the header for the ToolWindow (ToolWindowContainer).

We can set the ToolWindow tab background color using the TabBackground property, but not the background of the header.

Comments (6)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ulla,

For things like the title bar background, you'd need to redefine the theme brushes like:

{x:Static themes:AssetResourceKeys.DockingWindowContainerTitleBarBackgroundInactiveBrushKey}

That particular one is for an inactive title bar background.  You can define any brush with that key within the Application.Resources.  Several of the Themes QuickStarts show this sort of thing. 


Actipro Software Support

Posted 6 years ago by Jared Checkley - Beijer Electronics AB
Avatar

Thanks for your reply!

With the hint above we pasted the content from AeroNormalColor.xaml into our Application.Resources and we could adjust most of the colors, but we cound not set the colors (Titlebar & Tabitem) in floating state.

If we instead used it as in the sample

ThemeManager.RegisterThemeCatalog(ThemeName.Custom, new CustomDockingThemeCatalog());

and inside CustomDockingThemeCatalog refering to a file with the same pasted content, also the floating state was updated OK.

What is the difference?

Can we achieve the same by only modifying our Application.Resources  xaml-file?

//Best regards

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ulla,

All our ThemeManager does is swap XAML resource dictionaries into the Application.Resources.  So you should be able to skip the theme catalog and put brushes directly in Application.Resources directly, but only if you want them applied to all themes your app uses.

If you want the brush to change based on the Actipro theme that is active, you should use the theme catalog approach.


Actipro Software Support

Posted 6 years ago by Jared Checkley - Beijer Electronics AB
Avatar

Hi again,

By putting the brushes directly in Application.Resources, the settings are only applied if the windows are docked within the DockSite.

If the ToolWindow state is changed to float, the color settings are not applied. Instead it falls back to the theme colors.

Any workaround avaiable for apply the color settings also in floating state?

//Best regards

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ulla,

I just tested and it works fine for me in all scenarios (including floating) when I put the overrides in the Application.Resources, like this:

<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.DockingWindowContainerTitleBarBackgroundInactiveBrushKey}" Color="Red" />
<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.DockingWindowContainerTitleBarBackgroundActiveBrushKey}" Color="Green" />


Actipro Software Support

Posted 6 years ago by Daniel Hilmersson
Avatar

Thanks for your reply!

I am the devloper that posted the questions above, but now I have my own account.


 

Now it works. I had placed the brushes in the ResourceDictionary of the Shell.xaml instead of the App.xaml. My bad.

Best regards

Daniel

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.