Man*_*utz 5 c# wpf xaml combobox
我有一个自定义的 WPF 下拉框。一切都按预期工作,但是当组合框获得焦点时,组合框项目周围会出现虚线边框。我怎样才能摆脱这个边界?

我试图覆盖“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>
Run Code Online (Sandbox Code Playgroud)
我不确定这个边界从哪里来以及如何消除它。
感谢您的想法和提示
正如 Melak 指出的,您需要将其设置在ComboBox. 如果您仍想使用样式,可以这样做:
<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>`
Run Code Online (Sandbox Code Playgroud)