WP7如何实现更好的枢轴控制



我正在使用透视控件来显示大量图像(大约 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();
            }
        }

如果您需要更多帮助,请告诉我。

谢谢卡迈勒。

最新更新