Change AssetResourceKeys colors with colors from palette

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 7 months ago by Kristoffer
Version: 20.1.1
Avatar

I wan't to change the button background checked brush, to something lighter in the when using the Dark theme, to make it stand out a bit more that it is checked. I found out that I can change the AsseResourceKey like this:

<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ButtonBackgroundCheckedBrushKey}" Color="#76797F"/>

Is there some way to change it to a color in the color palette instead of hard coding it, to make it work with different themes?

Something closer to this:

<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ButtonBackgroundCheckedBrushKey}" Color="{DynamicResource {x:Static themes:AssetResourceKeys.ColorPaletteGrayBackgroundHighestBrushKey}}"/>

Comments (1)

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We have a TODO item to possibly open up a way to allow customization of assets during theme generation.  We don't have that feature at this time, but I'll log your request with the item.

In the meantime, you might have to create a ColorPalette object using your ThemeDefinition and use that information to programmatically build up a new ResourceDictionary with any overrides of brushes you have.  Then if you add that ResourceDictionary to the Application.Resources, it should override our own generated resources.  You could repeat this process on each theme change.

I hope that helps!


Actipro Software Support

The latest build of this product (v21.1.3) was released 12 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.