#490 – Using the InkCanvas to Recognize Gestures, part II
February 8, 2012 Leave a comment
With the EditingMode of an InkCanvas set to GestureOnly or to InkAndGesture, the InkCanvas will attempt to recognize any gestures drawn using a mouse or a stylus.
You can handle the Gesture event of an InkCanvas and then call the GetGestureRecognitionResults to get a list of candidate gestures that the InkCanvas thinks that you drew. In the example below, we get this list of gestures and dump them out to a debug window.
private void ink_Gesture(object sender, InkCanvasGestureEventArgs e)
{
ReadOnlyCollection<GestureRecognitionResult> gestures = e.GetGestureRecognitionResults();
foreach (GestureRecognitionResult gest in gestures)
{
Trace.WriteLine(string.Format("Gesture: {0}, Confidence: {1}", gest.ApplicationGesture, gest.RecognitionConfidence));
}
}
Below are some example gestures, followed by the list of GestureRecognitionResult objects. Each has a Confidence property that indicates how confident .NET is of the suggested result.



