Skip to main content
Version: 11.0.x


Avalonia UI, unlike some other frameworks, doesn't segregate touch events. Instead, it uses a pointer event system which unifies mouse, stylus, and touch events. This means that rather than having separate TouchEnter or TouchLeave events, you would use PointerPressed, PointerMoved, and PointerReleased events to track touch inputs.

Using Gesture Recognizers

In addition to basic touch events, Avalonia provides built-in gesture recognizers that make handling common touch gestures like pinch and scroll a breeze. Here's how you can use them:

<Image Stretch="UniformToFill"
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True"/>

In this example, an Image control is set up to respond to pinch and scroll gestures. The PinchGestureRecognizer enables pinch-to-zoom functionality, and the ScrollGestureRecognizer allows the image to be scrolled both horizontally and vertically.