title: How can I best handle WPF radio buttons?
body: <p>I've got some RadioButtons in my XAML...</p>
  
  <pre><code>&lt;StackPanel&gt;
      &lt;RadioButton Name="RadioButton1" GroupName="Buttons" Click="ButtonsChecked" IsChecked="True"&gt;One&lt;/RadioButton&gt;
      &lt;RadioButton Name="RadioButton2" GroupName="Buttons" Click="ButtonsChecked"&gt;Two&lt;/RadioButton&gt;
      &lt;RadioButton Name="RadioButton3" GroupName="Buttons" Click="ButtonsChecked"&gt;Three&lt;/RadioButton&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p>And I can handle their click events in the Visual Basic code.  This works...</p>
  
  <pre>
      Private Sub ButtonsChecked(ByVal sender As System.Object, _
                                 ByVal e As System.Windows.RoutedEventArgs)
          Select Case CType(sender, RadioButton).Name
              Case "RadioButton1"
                  'Do something one
                  Exit Select
              Case "RadioButton2"
                  'Do something two
                  Exit Select
              Case "RadioButton3"
                  'Do something three
                  Exit Select
          End Select
      End Sub
  </pre>
  
  <p>But, I'd like to improve it.  This code fails...</p>
  
  <pre><code>&lt;StackPanel&gt;
      &lt;RadioButton Name="RadioButton1" GroupName="Buttons" Click="ButtonsChecked" Command="one" IsChecked="True"&gt;One&lt;/RadioButton&gt;
      &lt;RadioButton Name="RadioButton2" GroupName="Buttons" Click="ButtonsChecked" Command="two"&gt;Two&lt;/RadioButton&gt;
      &lt;RadioButton Name="RadioButton3" GroupName="Buttons" Click="ButtonsChecked" Command="three"&gt;Three&lt;/RadioButton&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <pre>
      Private Sub ButtonsChecked(ByVal sender As System.Object, _
                                 ByVal e As System.Windows.RoutedEventArgs)
          Select Case CType(sender, RadioButton).Command
              Case "one"
                  'Do something one
                  Exit Select
              Case "two"
                  'Do something two
                  Exit Select
              Case "three"
                  'Do something three
                  Exit Select
          End Select
      End Sub
  </pre>
  
  <p>In my XAML I get a blue squiggly underline on the <strong>Command=</strong> attributes and this tip... </p>
  
  <pre>'CommandValueSerializer' ValueSerializer cannot convert from 'System.String'.</pre>
  
  <p>In my VB I get a green squiggly underline on the <strong>Select Case</strong> line and this warning...</p>
  
  <pre>Runtime errors might occur when converting 'System.Windows.Input.ICommand' to 'String'.</pre>
  
  <p>Even better would be to use Enum type commands with full Intellisense and compile errors rather than runtime errors in case of typos.  How can I improve this?</p>