title: How to know the index of radiobutton selected
body: <p>How to know the selcted index of a radio button to know which index option is selcted by user.</p>
  
  <p>Currently my code displays the items read. But when i select the items appeared then it shows in a textblock the 
  selected item of radiobutton (of the given 3 options, because my radiobutton currently has 3 items).</p>
  
  <p>My try fo this is :</p>
  
  <pre><code>foreach (String item in param.Parameter[lop].Component.Attributes.Items)
  {
      RadioButton radio = new RadioButton()
      {
          Content = item,
          GroupName = "MyRadioButtonGroup"
      };
      radio.Checked += (o, e) =&gt;
      {
          txtblkShowStatus.Text = item;       
      };
      data= param.Parameter[lop].Label;
      sp.Children.Add(radio);                           
  }
  </code></pre>
  
  <p>Now i want something like insted of "item" based selection now i want index based seelction.
  I want some thing like . If user select 2nd button(of radiobutton) then i will display some UI element. And the items are obtained on deserializing an xml. Which only deals with the index of the radio buttons. So i want something like <code>if(selectedIndexofRadioButton ==IndexObtainedFromXmlInIntegr){do something}</code> </p>
  
  <p><strong>Is it possible to do? If yes then how should i change my code to achieve this ?</strong>
  EDIT: My code change after DonBoitnott's answer edit is :</p>
  
  <pre><code>foreach (String item in param.Parameter[lop].Component.Attributes.Items)
                          {
                              RadioButton radio = new RadioButton()
                              {
                                  Content = item,
                                  GroupName = "MyRadioButtonGroup",
                                  Tag=tg
                              };
                              radio.Checked += (o, e) =&gt;
                              {
                                  txtblkShowStatus.Text = item;
                                  if (((Int32)((RadioButton)o).Tag).Equals(2))
                                  {
                                      MessageBox.Show("hurrey");
                                  }
                              };
                              radio.Tag=1;
                              data= param.Parameter[lop].Label;
                              sp.Children.Add(radio);
                              index++; tg++;
                          }
  </code></pre>