Silverlight does INK! Yay. I’ve been asking about it for a while thinking it was the next natural step. I actually have played with it a bit and have a little app that I wrote that I need to deploy with the GoLive license. This is with the 1.0 version of Silverlight so it is all javascript against the InkPresenter XAML object. This also means that it is very different than coding against the Tablet PC API. However with the .NET runtime support for Silverlight that will change.
The InkPresenter has a StrokeCollection, just like we are familiar with in the Ink API. And then you drill into each individual stroke and even stylus points. With the stylus point data not only can you redisplay the ink in XAML, but you can redraw it and you can do so in real time (eg at the same speed that it was originally drawn in.
The way you interact with the user drawing ink via the javascript is by responding to mousedown, mousemove and mouseup events. Billy Hollis recognized this as how he worked with ink before we had the Ink APIs. It’s a little frustrating to have to work at this low level but it’s very interesting and i have a lot of flexibility. However, I do look forward to the .NET runtime implementation!
As always, my key interest is in persisting the ink. This can be done in XAML (you have to iterate through the ink structure and create the XAML, a function which can be encapsulated of course) and the CreateFromXAML javascript function will deserialize the XAML back into the inkdata that can be fed into the InkPresenter.
This is a pretty high level description and I’ll explain more of the guts of what I have done in a later post as well as have a screencast available while I deal with getting the golive version on the web.
In the meantime, check out Gavin Gear’s blog – he is a Program Manager on the tablet team and has done some amazing work with ink in Silverlight. Along with Sam George, he gets to show off a very cool demo tomorrow that they wrote. There are some live examples in the Silverlight gallery as well.
From Gavin’s blog
Want to check out a Silverlight Ink sample? Check out “Ink Tattoo Studio” and “Page Turn” here:
http://silverlight.net/community/communitygallery.aspx
Also, I know that Loren Heiny , who has always been a great innovator with tablet pc development, is playing with this stuff too. So keep an eye on his blog as well.
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!