tags:

views:

297

answers:

1
+1  A: 

I would recommend to remove the outer StackPanel to a Grid, since Stackpanel wont respect the children size. And remove the ScrollViewer.Height binding. Now you just need to create two RowDefinition for the Grid and place the Label to Grid.Row=0 and ScrollViwer to Grid.Row=1.

Code is below. So my tip here is, use StackPanel/Canvas only if necessary and may be for the inner levels. Try to use Grid more to get very dynamic layouts.

  <Border>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Label Grid.Row="0" Width="Auto" Height="Auto" Content="Text to mess up the scrollview"/>
        <ScrollViewer Grid.Row="1" >
            <StackPanel>
                <Button MinWidth="100" MinHeight="100" Content="Button"/>
                <Button MinWidth="100" MinHeight="100" Content="Button"/>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</Border>
Jobi Joy
hey , that works. I see now that because the RowDefinition for the ScrollViewer is *, so it has a defined size and thus works. Thanks :)
Andrew Keith