Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF - touch gestures - suppressed mouse click if scrolling

I have multiple videos in ScrollViewer and when I click on one of these videos It plays and I got movie on fullscreen and where I moved with scroll bar It's moving with videos. This is okay. I have implemented this by adding mouse click to media element and now I am testing this on touch screen and it's working.

But I want to differentiate between click on video and moving in that area. That user don't want to "select" video but he is just moving with area but not in scroll bar but in area with videos. For better understanding I added image:Example

To have WPF make difference between click and move (to have both but still calling just one). What is the best way to do this? Thanks

like image 517
Libor Zapletal Avatar asked Apr 17 '13 08:04

Libor Zapletal


1 Answers

It is very hard to handle touch events on your own, especially when you have to handle nested controls.

I think the easiest way to solve this, is for you to use the Microsoft Surface Touch Pack

Replace your ScrollView with a SurfaceScrollView and place a transparent SurfaceButton above your MediaElements and react on the Click-event (or handle it via the a command).

This way, Microsoft does the tricky panning (scrolling) or tapping (clicking) for you. And as a nice side effect, you get things like bouncing and interia of the ScrollViewer for free.

like image 137
Bernhard Krenz Avatar answered Nov 17 '22 05:11

Bernhard Krenz