title: Dynamically Generate Set of RadioButtons With Different Content in WPF
body: <p>I am a C++ developer and recently shifted to C#. I am working on a WPF app where I need to dynamically generate 4 radio buttons. I tried to do lot of RnD but looks like this scenario is rare.</p>
  
  <p><strong>XAML:</strong></p>
  
  <pre><code>&lt;RadioButton Content="Base 0x" Height="16" Name="radioButton1" Width="80" /&gt;
  </code></pre>
  
  <p>Now here is the scenario: I should generate this radio button 4 times with different <code>Content</code> as follows:</p>
  
  <pre><code>&lt;RadioButton Content = Base 0x0 /&gt;
  &lt;RadioButton Content = Base 0x40 /&gt;
  &lt;RadioButton Content = Base 0x80 /&gt;
  &lt;RadioButton Content = Base 0xc0 /&gt;
  </code></pre>
  
  <p>I had done this in my C++ application as follows:</p>
  
  <pre><code>#define MAX_FPGA_REGISTERS 0x40;
  
  for(i = 0; i &lt; 4; i++)
  {
      m_registerBase[i] = new ToggleButton(String(T("Base 0x")) + String::toHexString(i * MAX_FPGA_REGISTERS));       
      addAndMakeVisible(m_registerBase[i]);
      m_registerBase[i]-&gt;addButtonListener(this);
  }
  m_registerBase[0]-&gt;setToggleState(true); 
  </code></pre>
  
  <p>If you notice above, Every-time for loop runs Content name becomes <code>Base 0x0</code>, <code>Base 0x40</code>, <code>base 0x80</code> and <code>base 0xc0</code> and sets the toggle state of first radiobutton as true. Thus if you notice there will be single button click method for all these 4 buttons and based on index each will perform operation.</p>
  
  <p>How can i achieve this in my WPF app? :)</p>