Gene Lim
Gene Lim

Reputation: 1068

Scrollviewer bounced back up after scrolled down. - Windows Phone

I am trying to view my data from the windows phone. The data amount will depend on how many data there is on that specific date. For example 1/March/1010 has 10 informations, I should be able to scroll down to view the others. When I have scrolled, i bounced backed up after i released my finger from the screen. What have I done wrong here. Below is my XAML code:

<!--Pivot Control-->
    <phone:Pivot Title="MY APPLICATION">
        <!--Pivot item one-->
        <phone:PivotItem Header="today">
            <StackPanel>
                <toolkit:DatePicker x:Name="NowDate"  
                                    HorizontalAlignment="Left" 
                                    Width="456"
                                    Background="DarkBlue" 
                                    ValueStringFormat="{}{0:D}"
                                    Foreground="White"
                                    BorderBrush="DarkBlue" 
                                    />
                <TextBlock Name="NoData"
                           HorizontalAlignment="Left"
                           Text="No Information Available" 
                           Margin="18,0,0,0" 
                           Visibility="Collapsed"
                           />

                <!--Double line list with text wrapping-->
                <ScrollViewer VerticalScrollBarVisibility="Visible">
                    <phone:LongListSelector x:Name="MLongListSelector" 
                                            Margin="0,0,-12,0" 
                                            SelectionChanged="MainLongListSelector_SelectionChanged">
                        <phone:LongListSelector.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17">
                                    <TextBlock Text="{Binding Title}" 
                                               TextWrapping="Wrap" 
                                               Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                                    <TextBlock Text="{Binding Description}"
                                               Name="Description"
                                               TextTrimming="WordEllipsis" 
                                               MaxHeight="84"
                                               TextWrapping="Wrap" 
                                               Style="{StaticResource PhoneTextSmallStyle}"/>
                                </StackPanel>
                            </DataTemplate>
                        </phone:LongListSelector.ItemTemplate>
                    </phone:LongListSelector>
                </ScrollViewer>
            </StackPanel>
        </phone:PivotItem>

Upvotes: 0

Views: 536

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222532

You have to set the height of the ScrollViewer to be less than that of the Parent Control(In your case StackPanel). If the ScrollViewer is larger than it's child, the child will always bounce back to it's original position.

Upvotes: 1

Related Questions