0

ピボットコントロールを使用して、多数の画像(約300)を表示しています。3つのピボットアイテムを使用することを考えました。ユーザーがスワイプすると、ピボットアイテムを変更するか、アイテムのソースを更新します。しかし、これを効率的に行う方法がわかりませんか?

または、ピボットのようにジェスチャーを使用してスワイプ効果を刺激する方法はありますか?トランジションのようなもの?

4

1 に答える 1

0

通常の画像コントロールとジェスチャー操作イベントを使用して、前/次の写真を左から右、右から左にスワイプできます。

以下のコードを見つけてください。

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();
            }
        }

さらにサポートが必要な場合はお知らせください。

ありがとう、カマル。

于 2012-11-25T17:33:03.753 に答える