Attaching platform-specific gestures
Every mobile platform provides us with a way of handling gestures. The approach is not the same for each platform, but the point is the same: accept touch events from the user.
Xamarin.Forms, as of this writing, has cross-platform support for the tap gesture, but worry not, view renderers come to the rescue once again. In this recipe, we will demonstrate how to add long press behavior to BoxView
. The equivalent for each platform is iOS CGContext
, Android ViewGroup
, and Rectangle
for the Windows Phone equivalent.
How to do it…
- Create a Xamarin cross-platform application using Visual Studio. Xamarin Studio works too of course; just add the Windows platform if you need to use Visual Studio later. Let's give it the ...
Get Xamarin: Cross-Platform Mobile Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.