Remove dotted border from focused combobox item

c#, combobox, wpf, xaml

Solution

As Meleak pointed you need to set it on the `ComboBox`. If you want still 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>`

Problem

I have a customized WPF Drop Down box. Every thing is working as expected but when the combobox has focus there is a dotted border around the combobox item. How can I get rid of this border?. I have tried to override the "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 come from and how to get rid of it. Thank you for your ideas and hints

Original source