繁体   English   中英

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

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM