Share via


View.GestureRecognizers Property

Definition

The collection of gesture recognizers associated with this view.

public System.Collections.Generic.IList<Xamarin.Forms.IGestureRecognizer> GestureRecognizers { get; }
member this.GestureRecognizers : System.Collections.Generic.IList<Xamarin.Forms.IGestureRecognizer>

Property Value

System.Collections.Generic.IList<IGestureRecognizer>

A List of IGestureRecognizer.

Implements

Remarks

Adding items to this collection will associate gesture events with this element. This is not nessesary for elements which natively support input, such as a Button.

This example creates a tap gesture recognizer and associates it with an image. When the image is double tapped, it will become semi-transparent.

var image = new Image {Source = "image.png"};
var gestureRecognizer = new TapGestureRecognizer {
  TappedCallback = o => image.Opacity = 0.5,
  NumberOfTapsRequired = 2
};
image.GestureRecognizers.Add (gestureRecognizer);

Applies to