title: RadioButton binding in Windows Forms with INotifyPropertyChanged?
body: <p>I am trying to bind some RadioButtons to booleans in a class which in-turn enable/disable other elements on the form.  For example:</p>
  
  <pre><code>x radioButton1
      x checkBox1
  x radioButton2
      x checkBox2
  </code></pre>
  
  <p>I want to enable checkBox1 only when radioButton1 is selected and likewise for radioButton2 and checkBox2.</p>
  
  <p>When I try to bind these it takes two clicks to change a RadioButton selection.  It seems like the order of binds is causing a logic issue.</p>
  
  <p>Here is code that shows this.  The form is just two default named RadioButtons and two CheckBoxes.</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
  
          BindingSource bindingSource = new BindingSource(new Model(), "");
  
          radioButton1.DataBindings.Add(new Binding("Checked", bindingSource, "rb1Checked", true, DataSourceUpdateMode.OnPropertyChanged));
          radioButton2.DataBindings.Add(new Binding("Checked", bindingSource, "rb2Checked", true, DataSourceUpdateMode.OnPropertyChanged));
  
          checkBox1.DataBindings.Add(new Binding("Enabled", bindingSource, "cb1Enabled", true, DataSourceUpdateMode.OnPropertyChanged));
          checkBox2.DataBindings.Add(new Binding("Enabled", bindingSource, "cb2Enabled", true, DataSourceUpdateMode.OnPropertyChanged));
      }
  }
  
  public class Model : INotifyPropertyChanged
  {
      private bool m_rb1Checked;
      public bool rb1Checked
      {
          get { return m_rb1Checked; }
          set
          {
              m_rb1Checked = value;
              NotifyPropertyChanged("cb1Enabled");
          }
      }
  
      private bool m_rb2Checked;
      public bool rb2Checked
      {
          get { return m_rb2Checked; }
          set
          {
              m_rb2Checked = value;
              NotifyPropertyChanged("cb2Enabled");
          }
      }
  
      public bool cb1Enabled { get { return rb1Checked; } }
      public bool cb2Enabled { get { return rb2Checked; } }
  
      public Model()
      {
          rb1Checked = true;
      }
  
  
      #region INotifyPropertyChanged Members
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      private void NotifyPropertyChanged(string fieldName)
      {
          if (PropertyChanged != null)
          {
              PropertyChanged(this, new PropertyChangedEventArgs(fieldName));
          }
      }
  
      #endregion
  }
  </code></pre>
  
  <p>Anyone see a way to make this work?</p>