Search code examples
c#uwpinkcanvas

Can I draw a primitive shape to UWP inkcanvas?


I am coding a sketching interface using UWP inkcanvas. Basically, I need to provide feedback to the user's drawings, like checking stroke correctness, shape beautifulness etc.. I am thinking about providing interactive feedback directly on the ink canvas, using arrows, auxiliary lines to highlight the difference between the input and a template. The best way I can think of is to add extra shapes to inkcanvas, just like using drawLine in JPanel. But I kind of figured out that strokes is the only acceptable format in UWP inkcanvas. I am wondering if there is still any way I can use to achieve this goal?

Thanks in advance.


Solution

  • InkCanvas is not suitable for drawing something programmatically I believe. The easy way is ... just overlay the canvas like following,

    <Grid>
      <InkCanvas x:name="myInkCanvas" />
      <Canvas x:name="myOverlayCanvas" />
    </Grid>
    

    and draw your shapes to the myOverlayCanvas.