我想创建一个动画,从而当用户滚动“FrontScroll”时,应用程序会自动将同样大小的“BackgroundScroll”滚动到相同的偏移量相同的速率。在前后滚动之间分层是我想保持静态的图像。中间图像只填充1/4的屏幕,其余图像在png中是透明的。我试图创建其他图像在用户滚动时逐渐出现在静态图像上方和后面的效果。WP7 ScrollViewer以编程方式滚动背景ScrollViewer与前面的ScrollViewer同步
目前我在ManipulationCompleted上有一个活动,但它会产生一个非常“紧张”的效果,因为背景滚动不会滚动到位置,直到用户从屏幕上抬起手指为止。我想让动画即时显示,不管操作是否已完成,从而使2个滚动查看器保持完美同步。此外,当用户“滑动”ScrollViewer以移动更远的距离时,ManipulationCompleted事件不会触发,因此2个滚动查看器不会同步。我也尝试了MouseWheel,MouseLeave,MouseMove事件,但没有得到我期待的效果。
有谁知道我想要做什么可能与Windows Phone 7.5中的当前API的,如果有的话,我怎么能做到这一点的任何指针将不胜感激?
我目前的XAML和CodeBehind事件如下。
<ScrollViewer HorizontalAlignment="Center" Margin="0,0,0,0" Name="backgroundScroll" VerticalAlignment="Top" Background="Transparent" MaxHeight="Infinity">
<Image HorizontalAlignment="Center" Height="2000" Stretch="Fill" Source="[email protected]" />
</ScrollViewer>
<Image Source="[email protected]" 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="[email protected]" HorizontalAlignment="Center" Name="FrontScroll" Stretch="Fill" />
</StackPanel>
</ScrollViewer>
</Grid>
private void FrontScroll_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
backgroundScroll.ScrollToVerticalOffset(((ScrollViewer)sender).VerticalOffset);
}
你可以在视频/应用程序中显示这种行为的例子吗?我不明白你在找什么。 –