I am trying to create an animation whereby when a user Scrolls the "FrontScroll" the app automatically scrolls "BackgroundScroll", of the same size, to the same offset at the same rate. Layered in-between the front and background scroll is an image I would like to remain static. The middle image only fills 1/4 of the screen, the rest of the image is transparent in the png. I am trying to create the effect that other images appear gradually over and behind the static image when the user scrolls.
Currently I have an event on ManipulationCompleted which works, however it creates a very "jittery" effect, in that the background scroll does not scroll to position until the user lifts their finger from the screen. I would like to make the animation instant, whether the manipulation has completed on not, thus keeps the 2 ScrollViewers in perfect sync. Also at present, when a users "Flicks" the ScrollViewer to move a greater distance, the ManipulationCompleted event does not fire, thus the 2 ScrollViewers become out of sync. I have also tried the MouseWheel, MouseLeave, MouseMove events but none get the effect I am looking for.
Does anyone know if what I am trying to do is possible with the current API's in Windows Phone 7.5 and if so any pointers to how I can do this would be much appreciated?
My Current XAML and CodeBehind events are below.
<ScrollViewer HorizontalAlignment="Center" Margin="0,0,0,0" Name="backgroundScroll" VerticalAlignment="Top" Background="Transparent" MaxHeight="Infinity">
<Image HorizontalAlignment="Center" Height="2000" Stretch="Fill" Source="background@2x.png" />
</ScrollViewer>
<Image Source="MiddleStatic@2x.png" HorizontalAlignment="Center" Name="MiddleStatic" Stretch="Fill" VerticalAlignment="Top" Margin="-1,-1,0,0" />
<ScrollViewer HorizontalAlignment="Center" Name="FrontScroll" VerticalAlignment="Top" MaxHeight="Infinity" MinHeight="0" ManipulationCompleted="FrontScroll_ManipulationCompleted">
<StackPanel Background="#00000000">
<Image Height="2000" Source="FrontScrollImage@2x.png" HorizontalAlignment="Center" Name="FrontScroll" Stretch="Fill" />
</StackPanel>
</ScrollViewer>
</Grid>
private void FrontScroll_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
backgroundScroll.ScrollToVerticalOffset(((ScrollViewer)sender).VerticalOffset);
}