Impossible to override style of ComboBox in the SearchOverlayPane

SyntaxEditor for WPF Forum

Posted 4 months 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 (4)

Answer - Posted 4 months 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 4 months 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 4 months 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 4 months ago by Stéphane Grenier
Avatar

It works, thanks a lot

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

Add Comment

Please log in to a validated account to post comments.