Windows phone 7 WP7如何实现更好的枢轴控制?
我使用pivot控件来显示大量图像(大约300个)。我想到只使用3个透视项目,当用户滑动时,更改透视项目或更新项目源。但我不知道如何有效地做到这一点Windows phone 7 WP7如何实现更好的枢轴控制?,windows-phone-7,pivot,swipe,Windows Phone 7,Pivot,Swipe,我使用pivot控件来显示大量图像(大约300个)。我想到只使用3个透视项目,当用户滑动时,更改透视项目或更新项目源。但我不知道如何有效地做到这一点 或者有没有一种方法可以像轴心一样使用手势和刺激的滑动效果?类似于过渡?您可以使用带有手势操作事件的普通图像控件从左向右和从右向左滑动上一张/下一张照片 请在下面查找代码 XAML Code <!--ContentPanel - place additional content here--> <Grid x:Name=
或者有没有一种方法可以像轴心一样使用手势和刺激的滑动效果?类似于过渡?您可以使用带有手势操作事件的普通图像控件从左向右和从右向左滑动上一张/下一张照片 请在下面查找代码
XAML Code
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Margin="0">
<Image Margin="0" x:Name="ImagePanel" Source="{Binding SelectedPhoto.PhotoURL}" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
C# code
public SlideShow()
{
// Tag ManipulationCompleted event for the current page in the constructor.
ManipulationCompleted += new EventHandler<ManipulationCompletedEventArgs>(SlideShow_ManipulationCompleted);
}
// ManipulationCompleted event. Update the Previous/next photo based on the swipe direction.
void SlideShow_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
var manipEndPoint = e.TotalManipulation.Translation;
const int threshold = 100;
if ((manipEndPoint.X > _manipStartPoint.X) && ((manipEndPoint.X - _manipStartPoint.X) > threshold))
{
LoadPreviousPhoto();
}
else if ((manipEndPoint.X < _manipStartPoint.X) && ((_manipStartPoint.X - manipEndPoint.X) > threshold))
{
LoadNextPhoto();
}
}
XAML代码
C#代码
公共幻灯片()
{
//构造函数中当前页的标记操纵已完成事件。
操纵已完成+=新事件处理程序(幻灯片放映\u操纵已完成);
}
//操纵已完成事件。根据滑动方向更新上一张/下一张照片。
无效幻灯片放映\u操作已完成(对象发送者,操作已完成事件参数e)
{
var manipEndPoint=e.TotalManipulation.Translation;
常数int阈值=100;
如果((manipEndPoint.X>_manipStartPoint.X)&((manipEndPoint.X-_manipStartPoint.X)>阈值))
{
LoadPreviousPhoto();
}
否则如果((manipStartPoint.X<_manipStartPoint.X)和(_manipStartPoint.X-manippendpoint.X>阈值))
{
LoadNextPhoto();
}
}
如果你需要更多的帮助,请告诉我
谢谢,
Kamal。谢谢您的解决方案。但是你能提供一些方法来获得像pivot一样的滑动效果吗。有时用户只需按住并水平拖动它。