title: WPF: Placing textbox next to radiobutton in stackpanel
body: <p>I have a stackpanel containing two radio buttons (<em>Option 1</em> and <em>Option 2</em>). If the user selects Option 2 a textbox should be active that allows the user to give some more details about Option 2.</p>
  
  <p>I came up with two solutions but none of them is exactly what I want. This is how they look like:</p>
  
  <p><img src="https://i.stack.imgur.com/5dkMj.png" alt="Screenshot of solution #1 and #2"></p>
  
  <h2>Solution #1</h2>
  
  <p>The XAML-code of solution #1 is very simple and the result is pretty obvious:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;StackPanel Grid.Row="7" Grid.Column="1"&gt;
          &lt;RadioButton&gt;Option 1&lt;/RadioButton&gt;
          &lt;RadioButton&gt;Option 2:&lt;/RadioButton&gt;
          &lt;TextBox&gt;Some Text that details option 2&lt;/TextBox&gt;
      &lt;/StackPanel&gt;
  </code></pre>
  
  <p>What's good here is that the textbox uses the entire width. Nevertheless, that's not what I wanted since the textbox should be placed next to the Option 2.</p>
  
  <h2>Solution #2</h2>
  
  <p>The next step was to create a grid in the RadioButton-tags. That allowed me to place the textbox at the proper position but then the width doesn't scale up to 100 % anymore.</p>
  
  <p>The code looks like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;StackPanel Grid.Row="8" Grid.Column="1"&gt;
          &lt;RadioButton&gt;Option 1&lt;/RadioButton&gt;
          &lt;RadioButton&gt;
              &lt;Grid&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="Auto" /&gt;
                      &lt;ColumnDefinition Width="130*" /&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;TextBlock Grid.Column="0" &gt;Option 2:&lt;/TextBlock&gt;
                  &lt;TextBox Grid.Column="1" Margin="10,0,0,0"&gt;Some Text that details option 2&lt;/TextBox&gt;
              &lt;/Grid&gt;
          &lt;/RadioButton&gt;
      &lt;/StackPanel&gt;
  </code></pre>
  
  <p>Besides the point that this looks to me like a quite over-engineered solution, the question is here: <em>How to set the width of grid within a radio button entry to 100%?</em></p>
  
  <p>A similar question was asked here (<a href="http://stackoverflow.com/questions/787436/how-to-set-width-to-100-in-wpf">How to set width to 100% in WPF</a>) but using the <code>ItemContainerStyle</code> property does not work for radiobuttons.</p>
  
  <p>In my eyes, there must be a much easier (or at least a working) solution. Can anyone help?</p>