[英]WP7 how to implement a better pivot control?
我正在使用樞軸控制來顯示大量圖像(大約300張)。 我想到了只使用3個樞軸項目,並且當用戶滑動時,更改樞軸項目或更新項目源。 但是我不知道如何有效地做到這一點?
還是有一種方法可以像手勢一樣使用手勢和刺激滑動效果? 有點像過渡嗎?
您可以將正常的“圖像控制”與手勢操作事件一起使用,以從左向右和從右向左滑動以查看上一張/下一張照片。
請在下面找到代碼。
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();
}
}
讓我知道您是否需要更多幫助。
謝謝,卡瑪爾。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.