Sunday, August 20, 2017

Radiobutton requires clicking twice when databound

Taken from here https://stackoverflow.com/questions/19052725/radiobutton-requires-clicking-twice-when-databound


In the click event:
private void RadioButtonClick(object sender, EventArgs e)
{
    var rb = sender as RadioButton;
    if (rb != null && !rb.Checked)
    {
        rb.Checked = !rb.Checked;
    }
}
More read http://www.whilenotdeadlearn.com/blog/2008/07/surviving-winforms-databinding

2008 until 2017 ( this note ). Still exist until now.