question

level6 avatar image
0 Votes"
level6 asked ·

Touch screen interaction - PointerMoved after PointerPressed

In my app when a simple tap on the screen occurs with touch, I'm getting a PointerMoved event after the PointerPressed event. This does not happen when the same sort of interaction occurs with the mouse, left clicking on the screen.

The PointerMoved event is really unwanted and I'm looking for a way to filter this event out when there is just a simple tap on the screen.

There are other cases when I do need to process PointerMoved, so it not like I want to ignore every instance of this event.

I'm seeing this behavior over several devices and it has also been reported by testers of my app.

uwp
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RichardZhang-MSFT avatar image
0 Votes"
RichardZhang-MSFT answered ·

Hello,​

Welcome to our Microsoft Q&A platform!

In touch screen interactions, you can try to use the Tapped event, which represents a finger tapping the screen.

In the PointerPressed event, you can filter out finger triggers this way:

 private void Something_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)
     {
         // Do mouse things...
     }
 }

Thanks.

· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the reply. The problem with using the Tapped event is that it does not fire until after all the low level pointer event have fired. I still need to handle the low level events such as PointerMoved.

What I will probably need to do is filter out PointerMoved for touch.

0 Votes 0 · ·

Hi, This needs to be handled according to the scenario your application faces. If you don't need some functions of pointer movement, you can exclude the events triggered by Touch by PointerDeviceType in PointerMoved event

0 Votes 0 · ·