Q:

Displaying and resizing a GridRow when a certain height of child control is reached

I cannot seem to get my Grid right. I need a layout with two rows, the first row has a dynamic height based on a child grid's height. The second row contains a couple of Buttons, this row has a constant height of 30 pixels. When the content of the child grid has not yet reached a height of 842 pixels, the window should compress to fit the content. Otherwise, it expands based on the child Grid's height. 
If the content of the child grid reaches 842 pixels, I wanted to display a scroll bar only for the first Grid row. 
I have played around with MinHeight and MaxHeight but nothing has worked so far. Right now, the scroll bar appears far too late and the window doesn't compress when there is no content in the child grid.
 <Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition MaxHeight="35px" Height="35*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <ScrollViewer Grid.Row="0" Grid.Column="0" VerticalScrollBarVisibility="Auto" MinHeight="842px" Margin="0,0,0,13" Grid.RowSpan="2">
        <Grid>
        <Grid.ColumnDefinitions>               
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>                
        </Grid.RowDefinitions>

        //Many controls here...

        </Grid>
</ScrollViewer>
<Button Grid.Column="0" Grid.Row="1"></Button>
<Button Grid.Column="0" Grid.Row="1"></Button>
</Grid>  

EDIT: Added a picture for clarification.

A:

Like this?
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WpfApplication1"
        Title="MainWindow" SizeToContent="WidthAndHeight">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="35" />
        </Grid.RowDefinitions>
        <ScrollViewer Background="Yellow" Grid.Row="0"  VerticalScrollBarVisibility="Auto" MaxHeight="842" Margin="0,0,0,13">
            <Grid>
                <Rectangle Fill="Red" Width="100" Height="300" HorizontalAlignment="Center" VerticalAlignment="Center"></Rectangle>
            </Grid>
        </ScrollViewer>
        <Button  Grid.Row="1">But</Button>
    </Grid>

</Window>

