.NET MAUI › Gestures & Animations

How do you handle tap gestures on any view in MAUI?

Beginner

Answer

Add a TapGestureRecognizer to a view's GestureRecognizers and bind its Command (or handle Tapped). This lets non-button elements like images or labels respond to taps, and NumberOfTapsRequired supports double-tap.
<Image Source="heart.png">
    <Image.GestureRecognizers>
        <TapGestureRecognizer Command="{Binding LikeCommand}" />
    </Image.GestureRecognizers>
</Image>
Real-world example A like button made from an Image responds to taps via a gesture recognizer bound to a command.

Common follow-ups: How do you detect a double tap? | Which views support gestures?