ONTaW #3: Ink friendly editable label

This week’s Thing a Week was suggested by Mike Wood.  It’s a control I’m putting together for my WPF project for fun.  I really like the Tablet PC idea and enjoy using the pen as an input device where it makes sense, so I wanted a label that you could click on and bring up an ink editing panel.  So here we have a list of strings:

image

Click on one of them and get out the pen!

image

Through the magic of the control and WPF’s 2 way data binding, your listing is now updated!

image

The control itself is reasonably straightforward… it’s pretty much a label with a popup containing an InkCanvas and a few buttons.  There are still a few quirks I’m trying to work though (e.g. the right way to clear the list of strokes out of the InkAnalyzer, getting automatic recognition working so that you don’t have to click OK), but on the whole it’s functional.

One strange/irritating thing is that even though the ink stuff is more or less a 1st class control now in WPF, you still need to include some obscure references to get handwriting recognition.  You have to go to C:\Program Files\Reference Assemblies\Microsoft\Tablet PC\v1.7\ and add all the files there to your solution so that you can use classes like the InkAnalyzer.

You can find this sample code here.  Enjoy!