title: StackPanel in Grid: limit height
body: <p>I have a big main grid with several rows and columns. I want to place in one of these cells a vertical stackpanel. In this stackpanel there is a textblock and a scrollviewer. My problem is, that the stackpanel doesn't get limited by the cell, instead the stackpanel gets big enough to fit the whole scrollviewer. </p>
  
  <p>How can I solve this?</p>
  
  <p>EDIT: my xaml code:</p>
  
  <pre><code>&lt;Grid x:Name="Grid1" Margin="120,0,0,0" Width="1244"&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition Width="0*"/&gt;
                          &lt;ColumnDefinition Width="33*"/&gt;
                          &lt;ColumnDefinition Width="40"/&gt;
                          &lt;ColumnDefinition Width="50*"/&gt;
                          &lt;ColumnDefinition Width="40"/&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
                      &lt;Grid.RowDefinitions&gt;
                          &lt;RowDefinition Height="71"/&gt;
                          &lt;RowDefinition Height="40"/&gt;
                          &lt;RowDefinition/&gt;
                          &lt;RowDefinition Height="20"/&gt;
                      &lt;/Grid.RowDefinitions&gt;
                      &lt;StackPanel Grid.Column="3" Grid.Row="2" Grid.ColumnSpan="2" Margin="0"&gt;
                          &lt;TextBlock TextWrapping="Wrap" FontSize="48" Margin="0" VerticalAlignment="Top" Foreground="#FF0083FF" Text="Top 10:" HorizontalAlignment="Left" FontFamily="Segoe UI Light"/&gt;
                          &lt;ScrollViewer Margin="0,20,0,0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible"&gt;
                              &lt;StackPanel&gt;
                                  &lt;ListView x:Name="TopListView" ItemsSource="{Binding}" SelectionMode="None" Foreground="White" &gt;
                                      &lt;ListView.ItemTemplate&gt;
                                          &lt;DataTemplate&gt;
                                              &lt;StackPanel Orientation="Horizontal"&gt;
                                                  &lt;StackPanel &gt;
                                                      &lt;TextBlock FontSize="32" Text="1" Foreground="#FF0083FF"/&gt;
                                                  &lt;/StackPanel&gt;
                                                  &lt;TextBlock Text="{Binding Text}" Foreground="Black" 
                                                      FontSize="16" Margin="0,0,0,0" TextWrapping="Wrap" /&gt;
  
                                              &lt;/StackPanel&gt;
                                          &lt;/DataTemplate&gt;
                                      &lt;/ListView.ItemTemplate&gt;
                                  &lt;/ListView&gt;
                              &lt;/StackPanel&gt;
                          &lt;/ScrollViewer&gt;
                      &lt;/StackPanel&gt;
  
                  &lt;/Grid&gt;
  </code></pre>