title: Setting an element's width to the rest of container
body: <p>OK this is stupid! I'm confused. I have this <code>xaml</code>:</p>
  
  <pre><code>    &lt;StackPanel Style="{DynamicResource FormPanel}"&gt;
          &lt;StackPanel&gt;
              &lt;Label Content="{DynamicResource Label_FirstName}"
                     Target="{Binding ElementName=FirstName}"/&gt;
              &lt;TextBox x:Name="FirstName" /&gt;
          &lt;/StackPanel&gt;
          &lt;StackPanel&gt;
              &lt;Label Content="{DynamicResource Label_LastName}"
                     Target="{Binding ElementName=LastName}"/&gt;
              &lt;TextBox x:Name="LastName" /&gt;
          &lt;/StackPanel&gt;
          &lt;!-- and so one... for each row, I have a StackPanel and a Label and Textbox in it --&gt;
      &lt;/StackPanel&gt;
  </code></pre>
  
  <p>and this style:</p>
  
  <pre><code>&lt;Style x:Key="FormPanel" TargetType="{x:Type StackPanel}"&gt;
      &lt;Setter Property="Orientation" Value="Vertical"/&gt;
      &lt;Setter Property="HorizontalAlignment" Value="Stretch" /&gt;
      &lt;Style.Resources&gt;
          &lt;Style TargetType="{x:Type StackPanel}"&gt;
              &lt;Setter Property="Orientation" Value="Horizontal" /&gt;
              &lt;Setter Property="HorizontalAlignment" Value="Stretch" /&gt;
              &lt;Setter Property="Margin" Value="10"/&gt;
              &lt;Style.Resources&gt;
                  &lt;Style TargetType="{x:Type Label}"&gt;
                      &lt;Setter Property="Width" Value="140"/&gt;
                  &lt;/Style&gt;
                  &lt;Style TargetType="{x:Type TextBox}"&gt;
                      &lt;!-- this line doesn't affect --&gt;
                      &lt;Setter Property="HorizontalAlignment" Value="Stretch"/&gt;
                  &lt;/Style&gt;
              &lt;/Style.Resources&gt;
          &lt;/Style&gt;
      &lt;/Style.Resources&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>I want to set the <code>TextBox.Width</code> to the rest of container's (<code>StackPanel</code>) width. It seems in this case, <code>HorizontalAlignment = Stretch</code> not works. Have you any idea?</p>