I asked this over in the Avalon area, but it's really a tablet-and-WPF thing, so here goes...
Can someone point me to an example of how to recognize simple gestures
in WPF I've read lots of "Ink is buit-in in Avalon!" articles, and
I've watched presentations that go even as far as using InkAnalyzer to
recognize hand writing -- but all I'm looking for is something like
recognition of a strike out, and I can't find one for a WPF app.
The tantalizing Gesture attribute is there, but I have no idea how to
use it! I set my InkCanvas EditingMode to InkAndGesture (or to
GestureOnly) and still, no matter what I try, no calls to my callback.
Any help would be apprciated...
Thanks,
Russ

Recognizing Gestures?
Serenefive
One other thing to point out is that the TRP is not supported on 64bit operating systems. Are you running on XP 64bit
Thanks - Stefan Wick
Revoldo
Hi Russ,
all you need to do in InkCanvas is set EditingMode=InkAndGesture (or GestureOnly) and listen to the Gesture event.
Note: for this work you need a system with the gesture recognizer installed. It is installed by default on XP Tablet PC Edition and on Windows Vista. If you are not using one of the above operating systems, you'll have to install the Recognizer Pack first:
http://www.microsoft.com/downloads/details.aspx familyid=080184dd-5e92-4464-b907-10762e9f918b
Here is an example that implements a scratchout feature using gestures:
In Window1.xaml add:
<InkCanvas Name="myInkCanvas" EditingMode="InkAndGesture" Gesture="OnGesture"/>
In Window1.xaml.cs add:
using System.Windows.Ink;
void OnGesture(object sender, InkCanvasGestureEventArgs e)
{
ApplicationGesture topGesture = e.GetGestureRecognitionResults()[0].ApplicationGesture;
if (topGesture == ApplicationGesture.ScratchOut)
{
StrokeCollection strokesToDelete = myInkCanvas.Strokes.HitTest(e.Strokes.GetBounds(), 10);
myInkCanvas.Strokes.Remove(strokesToDelete);
}
else
{
e.Cancel = true;
}
}
Let me know if you have more questions about this.
Thanks - Stefan Wick
bselfridge
Thanks for the info. The problem is likely the missing recognizer pack. I tried using the link you provided, but it says I'm trying to install it on an unsupported operating system. I'm using Windows XP Service Pack 2, which it immediately goes on to list as one of the supported operating systems. Is there possibly something else that would cause it to fail to install, or another version I should be downloading
Then, assuming I can get it to recognize gestures, is it possible to recognize a gesture that occurs on top of another type of component Say I want to allow the user to remove an item from a listbox by the scratchout -- is it possible to arrange the InkCanvas and the listbox to allow that
Thanks again,
Russ
Tiggyboo
The Recognizer Pack has one prerequisite on non-Tablet operating system - it requires the TabletPC SDK 1.7 to be installed:
http://www.microsoft.com/downloads/details.aspx FamilyID=69640b5c-0ee9-421e-8d5c-d40debee36c2
So please install this first and then try the reco pack again. Let me know if this doesn't solve the problem.
Regarding your other question: Yes, that it possible. One approach would be hosting the ListBox in an InkCanvas. The tricky part is to switch the EditingMode dynamically between "None" (which allows the user to interact with ListBox) and "GestureOnly" (which collects input to be recognized as Gestures.
Another approach is using the System.Windows.Ink.GestureRecognizer object directly, without using InkCanvas. You can feed it any stroke data (think x/y coordinates) you have collected on your ListBox and have it look for scratchout gestures.
Thanks - Stefan Wick
Aadi
I had previously installed the 1.7 Tablet SDK. To be sure, I tried again, and it told me I had a new version of the SDK installed, and it wouldn't let me install the 1.7. I guessed the problem was the February Mobile and Tablet PC SDK I'd installed, so I removed that, and reinstalled the 1.7 SDK (which then installed OK), but still no luck installing the TRP.
Is there anything else that could be upsetting it
Thanks again,
Russ