I have an InkCanvas control that is taking my whole screen. It takes either mouse or touch input for drawing. I have the most basic configuration of InkCanvas and it looks like this:
<InkCanvas Grid.Row="2" x:Name="inkCanvas">
</InkCanvas>
I can draw strokes both using mouse and touch input. The behavior is consistent as far as stroke width/height are concerned (they are the same). However, when I try to draw on the same InkCanvas using my touch injection API (I inject touches into OS using Win32 Touch Functions), the strokes appear much thinner.
I tried changing the drawing attributes on it by adding the following:
<InkCanvas Grid.Row="2" x:Name="inkCanvas">
<InkCanvas.DefaultDrawingAttributes>
<DrawingAttributes Width="10" Height="10"/>
</InkCanvas.DefaultDrawingAttributes>
</InkCanvas>
After making this change the strokes drawn using touch injection proportionally grew in width and height. But once again they were much thinner compared to the mouse or direct touch input.
My question is if anyone has played with InkCanvas using the Windows Touch Injection API and knows exactly why InkCanvas is behaving differently between Direct Touch and Injected Touch.
Also, is there any other way to set InkCanvas strokes width and height except the way that I am doing?
OK, found the solution. It seems like when using touch input the OS is reporting some default pressure. InkCanvas itself honors that pressure and assigns a particular value to it.
My touch injection API is not reporting any pressure (e.g. it is 0). As a result the strokes would appear much thinner. The following line fixed it:
<InkCanvas>
<InkCanvas.DefaultDrawingAttributes>
<DrawingAttributes IgnorePressure="True"/>
</InkCanvas.DefaultDrawingAttributes>
</InkCanvas>