Reputation: 15
I am building an app for Windows Phone 8.1 and my scroll viewer keeps going back to the top after you release scrolling. Its like I drag it down and when I release it, it snaps back to top.
<ScrollViewer Margin="10,0,10,-1024" Height="1124" VerticalAlignment="Top"
VerticalScrollBarVisibility="Visible" VerticalScrollMode="Enabled"
AllowDrop="False" BringIntoViewOnFocusChange="True"
HorizontalScrollMode="Disabled" IsHoldingEnabled="True" >
<Grid Grid.Row="1" x:Name="ContentRoot" Height="468" Width="386" >
<TextBlock HorizontalAlignment="Left" Margin="64,326,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Foreground="White"
FontSize="16" Width="307" Height="68" >
<Run Foreground="#FFFF6767" Text="Single Phase "/>
<Run Foreground="#FFFF6767" Text="Amperes "/>
<Run Text="= "/>
<Run Text="(746 x Horsepower) / (Volts x Efficiency x Power Factor"/>
<Run Text=")"/>
</TextBlock>
</Grid>
</ScrollViewer>
Upvotes: 0
Views: 7062
Reputation: 3362
ScrollViewer is designed to handle content that is bigger than the surrounding container. So normally your ScrollViewer's height is smaller than its content's.
Just adjust the height of your ScrollViewer and content, e.g.:
<ScrollViewer Height="500" VerticalAlignment="Top" VerticalScrollBarVisibility="Visible" VerticalScrollMode="Enabled" AllowDrop="False" BringIntoViewOnFocusChange="True" HorizontalScrollMode="Disabled" IsHoldingEnabled="True" >
<Grid Grid.Row="1" x:Name="ContentRoot" Height="800" Width="386" >
[..]
</Grid>
</ScrollViewer>
In your case the Grid is much smaller than the ScrollViewer so I'd expect the behaviour you are describing.
Upvotes: 5