I am writing an app which is using the InkCanvas in UWP. In my App, I do enable double touch gesture to pan and zoom and single touch to ink. To do that I disable IsInputEnabled when I detect multi-touch. The code to do that looks something like this
InkManager.Element.InkPresenter.UnprocessedInput.PointerEntered +=
delegate (InkUnprocessedInput sender, PointerEventArgs args)
{
if (args.CurrentPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Touch)
{
_numContacts++;
if (_numContacts == 2)
{
InkManager.Element.InkPresenter.IsInputEnabled = false;
}
}
};
I then re-enable IsInputEnabled after the view manipulation.
Everything works fine, except for the ruler.
InkPresenterRuler Ruler = new InkPresenterRuler(InkManager.Element.InkPresenter)
{
Length = _container.Width
};
If I have a InkPresenterRuler attached to the canvas, then the ruler can't be moved anymore until I do add at least one stroke to the canvas. It looks like when I disable the input on the fly, the inking in progress got successfully aborted on the InkPresenter, but remained suspended on the attached ruler, until the following input got processed. The same problem apply to the InkPresenterProtractor.
I can't find any method (on the ruler or the canvas), which allow me to completely clean up the pending event, to make the ruler work properly programmatically.
Anyone working with InkCanvas on UWP that has a suggestion on how to solve this?
Thanks!!