Responding to custom user gestures

There are other types of gestures that the user can perform, such as drawing letters or other shapes. These gestures may be more complex than a twist or drag, so we cannot just rely on simple finger tracking, but rather we need shape recognition.

How to do it...

We can store, recognize, and visualize shape gestures using a GestureLibrary instance:

  1. We access a particular GestureLibrary by requesting one through the GestureLibraries type:
    GestureLibrary library = GestureLibraries.FromPrivateFile(this, "gestures");
  2. When we want to load the gestures, or refresh the library, we invoke the Load() method:
    library.Load();
  3. Then, we can list all the gestures in the library using the GestureEntries property:
    string[] entries = ...

Get Xamarin Mobile Development for Android Cookbook 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.