title: Prevent WPF control from expanding beyond viewable area
body: <p>I have an <code>ItemsControl</code> in my user control with a scroll viewer around it for when it gets too big (Too big being content is larger than the viewable area of the <code>UserControl</code>). The problem is that the grid that it is all in just keeps expanding so that the scroll viewer never kicks in (unless I specify an exact height for the grid). See code below and thanks in advance.</p>
  
  <pre><code> &lt;UserControl  x:Class="BusinessObjectCreationWizard.View.TableSelectionPageView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  
      &lt;GroupBox FontWeight="Bold" Height="300px"
                Header="Tables"
                Padding="2"&gt;
  
          &lt;ScrollViewer&gt;
  
              &lt;ItemsControl FontWeight="Normal" 
                            ItemsSource="{Binding Path=AvailableTables}"&gt;
                  &lt;ItemsControl.ItemTemplate&gt;
  
                      &lt;DataTemplate&gt;              
                          &lt;CheckBox Content="{Binding Path=DisplayName}"
                                    IsChecked="{Binding Path=IsSelected}"
                                    Margin="2,3.5" /&gt; 
                      &lt;/DataTemplate&gt; 
                  &lt;/ItemsControl.ItemTemplate&gt; 
              &lt;/ItemsControl&gt;
          &lt;/ScrollViewer&gt;
      &lt;/GroupBox&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>This user control is loaded here</p>
  
  <pre><code>&lt;Border Background="White" Grid.Column="1" Grid.Row="0"&gt;
          &lt;HeaderedContentControl Content="{Binding Path=CurrentPage}" 
                                  Header="{Binding Path=CurrentPage.DisplayName}" /&gt;
  &lt;/Border&gt;
  </code></pre>
  
  <p>I would like to not specify the height.</p>