title: WPF: TextBlock with Wrapped text should inherit width
body: <p>I have the following XAML:</p>
  
  <pre><code>            &lt;StackPanel&gt;
                  &lt;StackPanel Orientation="Horizontal"&gt;
                      &lt;Border Name="B1" Width="Auto"&gt;
                          &lt;DataGrid /&gt;
                      &lt;/Border&gt;
                      &lt;Border Name="B2" Width="Auto"&gt;
                          &lt;DataGrid /&gt;
                      &lt;/Border&gt;
                  &lt;/StackPanel&gt;
                  &lt;Border Name="B3" Width="Auto"&gt;
                      &lt;TextBlock TextWrapping="Wrap"
                                 Text="{Binding}"/&gt;
                  &lt;/Border&gt;
              &lt;/StackPanel&gt;
  </code></pre>
  
  <p>Basically, borders B1 and B2 are side by side on top, and B3 is below them.  B1 and B2 change their widths dynamically according to stuff going on in their contents.  I want the width of B3 to be the sum of the widths of B1 and B2, with word wrapping of the potentially long text in the TextBlock.</p>
  
  <p>The XAML above results in the text in the TextBlock not to wrap, which results in B3 being much wider then B1+B2.</p>
  
  <p>I want B3.width to inherit from the main StackPanel's width, which will be set by B1.width+B2.width, and I would like to do it without code behind if possible.</p>
  
  <p>Any ideas?</p>