WPF - touch gestures - depressed mouse click if scrolling

I have several videos in ScrollViewer, and when I click on one of these videos, it plays, and I have a movie in full screen, and I moved with the scroll bar. He moves with the video. This is normal. I implemented this by adding a click on the multimedia element, and now I am testing this on the touch screen and it works.

But I want to distinguish between a click on a video and a movement in this area. This user does not want to β€œselect” the video, but he simply moves with the area, but not in the scroll bar, but in the area with the video. For a better understanding, I added an image: Example

So that WPF makes the difference between click and movement (to have both, but still only one calling). What is the best way to do this? Thanks

+6
source share
1 answer

It is very difficult to handle touch events yourself, especially when you have to process nested controls.

I think the easiest way to solve this problem is to use the Microsoft Surface Touch Pack

Replace ScrollView with SurfaceScrollView and place a transparent SurfaceButton over your MediaElements and respond to the Click event (or handle it with the a command).

Thus, Microsoft does complex panning (scrolling) or clicking (clicking) for you. And as a pleasant side effect, you get it for free, like bouncing and interfering with ScrollViewer.

+2
source

All Articles