title: Parent control ScrollViewer scrolling instead of child control ScrollViewer
body: <p>I have this:</p>
  
  <pre><code>&lt;Window x:Class="ScrollTest.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow"
          Height="450"
          Width="525"&gt;
      &lt;ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Visible"
                    ScrollViewer.VerticalScrollBarVisibility="Visible"&gt;
          &lt;Grid&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition Height="Auto" /&gt;
                  &lt;RowDefinition Height="*" /&gt;
              &lt;/Grid.RowDefinitions&gt;
  
              &lt;GroupBox Grid.Row="0"
                        Header="Stuff"
                        Height="200"&gt;
                  &lt;TextBlock Text="Lots of controls go here"
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center" /&gt;
              &lt;/GroupBox&gt;
              &lt;TabControl Grid.Row="1"&gt;
                  &lt;TabItem Header="Main Tab"&gt;
                      &lt;TextBox MinHeight="100"
                               HorizontalAlignment="Stretch"
                               VerticalAlignment="Stretch"
                               HorizontalContentAlignment="Left"
                               VerticalContentAlignment="Top"
                               ScrollViewer.HorizontalScrollBarVisibility="Visible"
                               ScrollViewer.VerticalScrollBarVisibility="Visible"
                               AcceptsReturn="True" /&gt;
                  &lt;/TabItem&gt;
              &lt;/TabControl&gt;
          &lt;/Grid&gt;
      &lt;/ScrollViewer&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>When I add too many rows into the <code>TextBox</code>, instead of the <code>ScrollViewer</code> of the <code>TextBox</code> being used, the box stretches and the outermost <code>ScrollViewer</code> is used. Can I prevent that without fixing the height of the <code>TextBox</code> or <code>TabControl</code>? </p>
  
  <p><strong>Update:</strong></p>
  
  <p>If I remove <code>MinHeight</code> on the <code>TextBox</code> and set <code>MaxLines</code> to 5, this is what I get:</p>
  
  <p><img src="https://i.stack.imgur.com/WgJR3.jpg" alt="MinHeight removed and MaxLines set to 5"></p>
  
  <p>If I added a 6th line, the scroll bars of the <code>TextBox</code>'s <code>ScrollViewer</code> are used, but they still remain centered vertically in the <code>TextBox</code> control.</p>