다음을 통해 공유


Silverlight 2 Released - Write On!

Now that Silverlight 2 is released, I finally got around to updating my blog after a long time of silence. For those of you interested in handwriting and Tablet related technologies, I want to start out with a canonical example of a Silverlight 2 Inking application. There have been a couple of OM changes since Beta1 around ink and stylus in Silverlight, mostly in order to make the Silverlight API more consistent with the WPF Ink/Stylus APIs.

Just like in Silverlight 1.0, the key element to inking is the InkPresenter which is a Canvas-like element with the ability to render ink strokes. To bring it to live and actually enable ink collection (and eraser) funtionality you will need to write some code-behind that responds to the user's input. In my example I have encapsulated the required code into a re-usable 'InkCollector' class (in InkCollector.cs), so you can just instantiate and assign it to your InkPresenter in order to get started with inking in your own projects.

Here is my example - source code attached - try it out by using your mouse or stylus to write and erase ink:

InkSample.zip

Comments

  • Anonymous
    November 03, 2008
    Very slick! I never thought to zoom in on the ink. Hey are there changes since SL Beta2 that I should be watching out for?

  • Anonymous
    November 03, 2008
    No, all breaking changes for Ink/Stylus happened between Beta1 and Beta2.

  • Anonymous
    December 01, 2008
    wow!that's amazing!how do you do that?you are my hero

  • Anonymous
    December 01, 2008
    The complete source code of the sample is in the attached ZIP file.

  • Anonymous
    December 22, 2009
    Stefan, Thanks for blogging! Is there a way to prevent grid lines from being selectable?