views:

52

answers:

1

I'm using Expression Blend 4 to prototype a Windows Phone 7 app. I have a page that is supposed to display a news story. I'm having difficulty getting it to scroll down all the way in the emulator. I can only scroll the see some of the text box. Sometimes, when I make the ScrollViewer taller, I can actually scroll less in the emulator.

Here is the XAML:

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="ApplicationTitle" Text="NEWS" Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock x:Name="PageTitle" Text="New Physical Sciences Building: ‘Twenty-First Century Research’" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" TextWrapping="Wrap" FontSize="40"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <ScrollViewer Margin="0,0,8,-2332">
            <StackPanel>
                <Image Height="313" Width="454" Source="new physics building large.jpg"/>
                <TextBlock TextWrapping="Wrap"><Run Text=" really long text "/></TextBlock>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</Grid>

What am I doing wrong?

+2  A: 

Why does the ScrollViewer have a -2000 bottom margin? Try setting the width / height of the StackPanel instead...

Paul Betts
Hmm... with the following, I am unable to scroll at all: `<ScrollViewer Margin="0,0,8,0" Height="4000">` When I drag it out in Expression manually, it gets that huge negative margin.
Rosarch
I think you're misunderstanding the meaning of the Scrollviewer coordinates - it's the position of the *container*, not its *contents*. Set the ScrollViewer size to the size of the view (i.e. 200x400), then set the size of the *contents* to be really big
Paul Betts
ah, I see. Thanks.
Rosarch