Impossible to override style of ComboBox in the SearchOverlayPane

SyntaxEditor for WPF Forum

Posted 3 years ago by Stéphane Grenier
Version: 21.1.1
Avatar

Hello,

We have different themes in our application.
I want to override the style of the SearchOverlayPane. It's ok for buttons or border  by overriding style as the following code:

 <SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ContainerBackgroundLowBrushKey}" Color="Blue" />
 <SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ToolBarButtonBackgroundHoverBrushKey}" Color="Red" />
   

But I have a very weird behavior with the combobox under  PART_SearchScopeComboBox

If I change the style of the Background color (which is white by default) and lauch again then the color is always white but the key name is not the same as the previous one.

How to reproduce:

Background point to Key_1 (which is white)

I modify Key_1 to Red in my XAML 

Launch again

Background point now to Key_2 (which is white)  and not to Key_1!!!

I modify Key_2 to Blue in my XAML 

Launch again

Background point now to Key_3 (which is white)  and not to Key_1 nor Key_2 !!!

and so on...

How can I change the color of the background, foreground, selected_background or hover, of this combobox?

Thanks

Comments (6)

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

Hello,

The search scope ComboBox is using this referenced Style:

Style="{StaticResource {x:Static themes:SharedResourceKeys.ToolBarEmbeddedComboBoxStyleKey}}"

That Style uses Setters such as these by default:

<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ToolBarEditBackgroundNormalBrushKey}}" />
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ToolBarEditBorderNormalBrushKey}}" />
<Setter Property="BorderThickness" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ToolBarEditBorderNormalThicknessKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ToolBarButtonForegroundNormalBrushKey}}" />

I'm sorry but I'm not sure what you mean by the key changing, since keys don't really get altered anywhere.  That being said, simply modifying resources like those listed above should be enough to alter the appearance of the ComboBox.  


Actipro Software Support

Posted 3 years ago by Stéphane Grenier
Avatar

Thanks for your help,

I can now modify the style of the combo with those keys ( ToolBarEdit*...)

But I also need the right keys for the popup (with Document and Selection entries).
Foreground, Foreground/Background of the selected element,...

Thanks

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

ComboBox's use all the "AssetResourceKeys.ListItem*" asset resource brushes for borders/backgrounds.  The default foreground is ButtonForegroundNormalBrushKey and the highlighted foreground is ListItemForegroundSelectedFocusedBrushKey.


Actipro Software Support

Posted 3 years ago by Stéphane Grenier
Avatar

It works, thanks a lot

Posted 6 months ago by Norberto Magni
Avatar

Hi,

I have the same problem but I can't make this solution works (version 22.1.4).

I can change the popup items style with:

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

The combo-box background with:

<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ToolBarEditBackgroundNormalBrushKey}" Color="Blue" />

Which AssetResourceKeys should I use for foregrounds ? (I tried with those similar with 'foreground' but they don't seems to works)

thank you

p.s. How can I translate the text resources used for tooltips and "document"/"selection" ?

[Modified 6 months ago]

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

Hello,

Non-editable ComboBox controls in our themes use these foreground brushes in various scenarios:

<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ButtonForegroundNormalBrushKey}" Color="Yellow" />
<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ListItemForegroundSelectedFocusedBrushKey}" Color="Yellow" />
<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ToolBarButtonForegroundNormalBrushKey}" Color="Yellow" />

ToolTips in general use ToolTip* assets.  But SyntaxEditor IntelliPrompt tips will base backgrounds/foregrounds on the SyntaxEditor itself.

SyntaxEditor edit view colors come from registered highlighting styles, such as the ones for Plain Text, Selected Text, Inactive Selected Text, etc.  Please see the documentation and samples on highlighting styles to learn more about those.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.