Windows 8.1 Input: Ink sample in C#/Xaml

Updated Ink sample (C#) demonstrates how to use ink functionality (such as, capturing, manipulating, and interpreting ink strokes) in Windows 8.1 store apps using C# and XAML. Selection of ink strokes and touch devices are supported.

C# (305.7 KB)
 
 
 
 
 
5 Star
(4)
1,636 times
Add to favorites
12/29/2014
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Turn off autocorrect for spelling
    1 Posts | Last post June 29, 2014
    • is there is a way to turn off autocorrect as we are doing a spelling app?
  • Touch and scrolling
    1 Posts | Last post June 11, 2014
    • Thanks for your work on this example. It was bad that the official MS example didn't support touch.
      
      One interesting problem that I came up with was if the canvas is inside a scrollviewer and touch is used. (In my example I have a scrollable form with a 'signature' canvas at the bottom). When using touch and a scrollviewer, it seems that there is confusion as to where the gesture should go. The scrollbox wants to take the touch input for itself.
      
      This makes sense, as when you are in touch mode, any gestures will move (scroll) the content around. My solution was a simple fix to make sure that the canvas was not inside a scroll viewer. Later I may look at disabling the scrollviewer when the pointer event is within the canvas. (see http://blogs.msdn.com/b/wsdevsol/archive/2013/02/16/where-did-all-my-gestures-go.aspx)
      
      Similar problems exist when using a canvas that is larger than the screen, like if you have an existing image that pans or needs to be zoomed-in. So when is a touch gesture to ink or to pan? There doesn't seem to be a simple answer.
      
      If you have ideas, I would be interested to hear them.
  • Ink not accurate
    2 Posts | Last post May 21, 2014
    • Thank you for your excellent work on this sample.  I have a question about when drawing ink there is extra ink that shows up at the edges.  So when drawing a "h" or a "v" the ink will extend past where the bottom of the v should be or the first line on the "h"  I have tried it with both a mouse and stylus.  The stylus is more prone to this additional marks but it also shows up if using a mouse.  Is there a sensitivity setting or have you seen this?
      
      Thank you!
    • hey rigst,
      
      nice observation. The fix is to define the strokelinejoin in path, while rendering the stroke.
      
      So in the CanvasManager class, RenderStroke function you can add the following two lines to correct the problem (after setting the stroke thickness):
      
                  path.StrokeLineJoin = PenLineJoin.Round;
                  path.StrokeStartLineCap = PenLineCap.Round;
      
      Hope it helps,
      
      (I will try to update the solution as soon as possible)