Impossible to override style of ComboBox in the SearchOverlayPane

SyntaxEditor for WPF Forum

The latest build of this product (v21.1.1) was released 1 month ago, which was before this thread was created.
Posted 1 month ago by Stéphane Grenier
Version: 21.1.1


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?


Comments (4)

Answer - Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA


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 29 days ago by Stéphane Grenier

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,...


Answer - Posted 28 days ago by Actipro Software Support - Cleveland, OH, USA

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 27 days ago by Stéphane Grenier

It works, thanks a lot

Add Comment

Please log in to a validated account to post comments.