title: Switching bindings on a textbox based on radio button selection
body: <p>The scenario is that I have three radio buttons that each correspond to a different way a function should be evaluated. I have one textbox where the user can enter in a value, and I want the value to persist associated with the radio button that was selected when the value was entered. In the code behind I have three variables (one for each type of value) and the way I am currently maintaining the data is each time the checked or unchecked event gets triggered I am loading the proper value to the textbox and storing the old value in the proper variable. Of note, all three variables are the same type (string).</p>
  
  <p>I know this is not the best way to go about this so I would like to know if there was some way to bind the textbox to all of the variables and have it show the proper value based on which radio button is selected. I have a hunch that it involves using a multibinding with a dataconverter, but I am not sure how to give the data converter state information to decide which value to display or which variable it needs to store the old value to (I could switch to an array but I would still need to be able to get the radiobox selection in the converter). If you could give me some guidance about how to go about doing this that would be great. In case it wasn't clear I am working in C#/Xaml on a WPF application.</p>
  
  <p>Some snippets of what I currently have</p>
  
  <p>Sample Unchecked Event</p>
  
  <pre><code>private void Fixed_Unchecked(object sender, RoutedEventArgs e)
      {
          if (Value != null)
          {
              LastFixedValue = Value.Text;
          }
      }
  </code></pre>
  
  <p>Sample Checked Event</p>
  
  <pre><code>private void Fixed_Checked(object sender, RoutedEventArgs e)
          {
              if (PercentSign != null)
              {
                  PercentSign.Visibility = Visibility.Hidden;
              }
              if (Value != null)
              {
                  Value.IsReadOnly = false;
                  Value.Text = LastFixedValue;
                  Value.Background = Brushes.White;
              }
          }
  </code></pre>
  
  <p>I would still need some of the checked/unchecked events to handle the ui changes, but I would like to reduce the amount of code and handle binding properly</p>