Skip to content

Instantly share code, notes, and snippets.

@jpd21122012
Created June 2, 2025 20:01
Show Gist options
  • Save jpd21122012/0920d8d0194ae25df2078375975ddc7c to your computer and use it in GitHub Desktop.
Save jpd21122012/0920d8d0194ae25df2078375975ddc7c to your computer and use it in GitHub Desktop.
public class SwipePinchPage : ContentPage
{
public SwipePinchPage()
{
var swipeGesture = new SwipeGestureRecognizer();
swipeGesture.Swiped += (s, e) =>
{
Console.WriteLine($"Swipe direction: {e.Direction}");
};
var pinchGesture = new PinchGestureRecognizer();
pinchGesture.PinchUpdated += (s, e) =>
{
Console.WriteLine($"Pinch scale: {e.Scale}");
};
var frame = new Frame
{
BackgroundColor = Colors.LightGray,
Content = new Label { Text = "Swipe or Pinch Me!" }
};
frame.GestureRecognizers.Add(swipeGesture);
frame.GestureRecognizers.Add(pinchGesture);
Content = frame;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment