0
votes

Let's say I have TouchUp and TouchDown event handlers in a WPF form.

this.TouchDown += window_TouchDown;
this.TouchUp += window_TouchUp;

If I press down two fingers in two different places, each one will fire the TouchDown event. Then if I lift my fingers off in sequence, each one will fire a separate TouchUp event.

The trouble is that in that middle state, when I've lifted one finger off the tablet but one is still pressed down, I've fired a TouchUp event, but it isn't the final TouchUp event that will fire, since one finger is still "down."

What I want to do is capture the "last" TouchUp event, i.e. when the user has stopped touching the tablet completely. I realize I could try to do with with some sort of private int member to count how many touches there are at a time, but that seems hacky to me. I'm hopeful that there is some (boolean?) property on the window to determine if anything is touching it. Is there such a property? How do I accomplish what I'm trying to do?

1
And just in case you don't want to use manipulation events, there is a TouchDevice property on the TouchEventArgs, which has a unique Id that you could track. - Clemens

1 Answers

0
votes

Have you looked at Manipulation events?

This image shows how the manipulation events relate to the Touch events: enter image description here

Per MSDN documentation...

"When the last touch device on the element raises the TouchUp event, the manipulation logic generates the ManipulationInertiaStarting event."