Wpf radiobutton上奇怪的焦点矩形

Tru*_*der 4 wpf xaml radio-button

单击其中一个时,为什么矩形出现在单选按钮中.

Wpf radiobutton上奇怪的焦点矩形

XAML标记如下

<RadioButton GroupName="LabelDisp" IsChecked=".. Converter={StaticResource enumBooleanConverter}, ConverterParameter= LabOnly}" Content="{x:Static resx:StringRes.RadioButtonLab}" Style="{StaticResource ListOption}" Command="{Binding Path=Command}"></RadioButton>
<RadioButton GroupName="LabelDisp" IsChecked=".. Converter={StaticResource enumBooleanConverter}, ConverterParameter= DescOnly}" Content="{x:Static resx:StringRes.RadioButtonDesc}" Style="{StaticResource ListOption}" Command="{Binding Path=Command}"></RadioButton>
<RadioButton GroupName="LabelDisp" IsChecked=".. Converter={StaticResource enumBooleanConverter}, ConverterParameter= LabAndDescr}" Content="{x:Static resx:StringRes.RadioButtonBoth}" Style="{StaticResource ListOption}" Command="{Binding Path=Command}"></RadioButton>
Run Code Online (Sandbox Code Playgroud)

Tru*_*der 21

我返回null应该返回Binding.Donothing而不是.

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                return (bool)value ? Enum.Parse(targetType, parameter.ToString(), true) : Binding.DoNothing;
            }
Run Code Online (Sandbox Code Playgroud)


Roh*_*ats 5

这些称为FocusVisualStyle,您可以将其删除-

<RadioButton FocusVisualStyle="{x:Null}"/>
Run Code Online (Sandbox Code Playgroud)

更新资料

是的,HB是正确的,我以为您是在谈论我们单击单选按钮时出现的虚线边框。但是,看来validation border,请检查您的转换器代码,发现其中有问题。