Hello:
I have radio buttons bound to boolean properties in a business object.
private void bindRadioButton(RadioButton button, string
propertyName)
{
Binding binding = button.DataBindings.Add("Checked",
exclusionBindingSource,
propertyName,
false,
DataSourceUpdateMode.OnPropertyChanged,
false);
binding.ControlUpdateMode =
ControlUpdateMode.OnPropertyChanged;
button.Enabled = exclusionBindingSource.Count 0;
}
When I click on another radio button, the radio group is cleared
instead of checking the radio button I clicked on. I have to double
click on a radio button to switch it.
I know why this is happening: since my radio buttons are updated
automatically by the data source (i.e., my business object), when I
click off a radio button, no booleans are set. This makes the radio
button group cleared before the clicked-on radio button has a chance
to modify the business object.
Is there a way to get around this?
In time it is happening like this:
1) The ex-checked button realizes it is no longer checked.
2) The ex-checked button updates the data source.
3) The interface realizes a change in the data source and updates the
interface to clear the group.
4) The clicked-on button never gets set because the interface already
cleared the group.
5) I cry a lot and stomp my feet.
Any ideas how to get around this?
Thanks,
Travis