Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

strange focus rectangles on wpf radiobutton

Why does the rectangle appear in the radio buttons when one of them is clicked.

strange focus rectangles on wpf radiobutton

the XAML markup is given below

<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>
like image 494
TrustyCoder Avatar asked Aug 15 '12 14:08

TrustyCoder


3 Answers

I was returning null should have returned Binding.Donothing instead.

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                return (bool)value ? Enum.Parse(targetType, parameter.ToString(), true) : Binding.DoNothing;
            }
like image 59
TrustyCoder Avatar answered Nov 13 '22 11:11

TrustyCoder


Those are called FocusVisualStyle, you can remove it -

<RadioButton FocusVisualStyle="{x:Null}"/>

Update

Yeah H.B. is right, i thought you was talking about dotted border we got on clicking radioButton. But it seems a validation border, check your converter code, something is breaking in it.

like image 5
Rohit Vats Avatar answered Nov 13 '22 10:11

Rohit Vats


Looks like a validation error to me, possibly because of the spaces at the front of the ConverterParameter. (You might want to consider using another method for binding RadioButtons)

like image 2
H.B. Avatar answered Nov 13 '22 09:11

H.B.