While the image is being panned, we want to update the state, as follows:
- Open Controls/SwiperControl.xaml.cs.
- Add the following code in bold to the PanRunning() method:
private void PanRunning(PanUpdatedEventArgs e)
{
photo.TranslationX = e.TotalX;
photo.TranslationY = e.TotalY;
photo.Rotation = _initialRotation + (photo.TranslationX / 25);
CalculatePanState(e.TotalX);
}
This addition to the PanRunning() method passes the total amount of movement on the x axis to the CalculatePanState() method, to determine if we need to adjust the opacity of either the StackLayout on the right or the left of the control.