Handling pan gestures

A core feature of this app is the pan gesture. A pan gesture is when a user presses on the control and moves it around the screen. We will also add a random rotation to the Swiper control to make it look like there are photos in a stack when we add multiple images.

We start by adding some fields to the SwiperControl:

  1. Open the SwiperControl.xaml.cs file.
  2. Add the following fields in the code to the class:
private readonly double _initialRotation;private static readonly Random _random = new Random();

The first field, _initialRotation, stores the initial rotation of the image. We will set this in the constructor. The second field is a static field containing a Random object. As you might remember, it's better to create ...

Get Xamarin.Forms Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.