Distinguish touch from scrolling


I'm making an application that will be used on touch screens. The problem I have is that I do not know how to distinguish between scrolling and simple touch.

I have a scrollviewer that contains a stackpanel where I am adding images. The idea is that when an image is played, an associated video is opened in full screen, but the list is large and it should be possible to do scrolling. Right now if I drag over the image, I directly open the video. I do not know how to differentiate the scroll event with the simple touch event.

        <ScrollViewer Name="viewer" VerticalScrollBarVisibility="Auto" Margin="0,50,0,0" PanningMode="VerticalOnly" PanningDeceleration="0" PanningRatio="1">
        <StackPanel Name="pnlVideos" Orientation="Vertical"></StackPanel>

I add the images from the C # code and associate them with the TouchDown event.

 img = new Image();
 img.Width = 400;
 img.Height = 225;
 img.Name = "img_" + j;
 img.TouchDown += PlayVideo;
 img.Margin = new Thickness(20, 10, 0, 0);
 img.Tag = thumb.FullName;

Thanks for the help.

asked by Fernando Macias Ceballos 26.01.2018 в 10:11

1 answer


Finally, I have solved it by changing the image event to MouseDown.

 img.MouseDown += PlayVideo;
answered by 26.01.2018 / 10:56