Remove the dashed border from the counter object

I have a custom Drop Drop checkbox. Each thing works as expected, but when there is focus in the combo box, there is a dotted border around the combobox element. How can I get rid of this border?

Dotted border

I tried to override "FocusVisualStyle"

<Style TargetType="{x:Type ComboBox}"> ....snip <Setter Property="ItemContainerStyle"> <Setter.Value> <Style TargetType="{x:Type ComboBoxItem}"> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> </Style> </Setter.Value> </Setter> </Style> 

I’m not sure where this border came from and how to get rid of it.

Thanks for your ideas and tips.

+4
source share
2 answers

As Meleak said, you need to install it on a ComboBox . If you want to use a style, you can do this:

 <Window.Resources> <Style x:Key="cmbStyle" TargetType="{x:Type ComboBox}"> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> </Style> </Window.Resources> <Grid> <ComboBox Style="{StaticResource cmbStyle}"> <ComboBoxItem FocusVisualStyle="{x:Null}">33</ComboBoxItem> <ComboBoxItem>34</ComboBoxItem> <ComboBoxItem>334</ComboBoxItem> </ComboBox> </Grid>` 
+3
source

Set FocusVisualStyle for ComboBox to null

 <ComboBox FocusVisualStyle="{x:Null}" ... 
+2
source

All Articles