locked
How to implement swipe, zoom and scroll gestures in windows store app using xaml and c#

    Question

  • Hi All,

    I have one page which consists of listview and webview as shown below. Now I want to implement swipe, zoom and scroll gestures on both listview and webview. I have implemented the swipe gesture detection by attaching a manipulationcompleted event to the grid(which contains both listview and webview) like

    MainTransGrid.ManipulationMode =

    ManipulationModes.TranslateX | ManipulationModes.TranslateY;

    private

    voidMainTransGrid_ManipulationCompleted(objectsender, ManipulationCompletedRoutedEventArgse)

            {

               

    varvelocities = e.Velocities;

               

    if(velocities.Linear.X > 0.2 && (velocities.Linear.Y > -0.2 && velocities.Linear.Y < 0.2))//user cannot swipe exactly horizontally so considering 20% in variation. 

                {


                    previousitem();

                }

               

    elseif(velocities.Linear.X < -0.2 && (velocities.Linear.Y > -0.2 && velocities.Linear.Y < 0.2))

                {

                   


                    nextitem();

                }

            }

    the problem here is I am not able to detect the swipe operation on webview control (if user swipes on webview it's just selecting the text. ). And also I want to implement zoom and scroll gestures.

    could anyone please help me to figure out the solution for this problem.




    Friday, October 24, 2014 10:46 AM

Answers

  • See the remarks in the WebView documentation. As explained there the WebView isn't a control and doesn't provide pointer input etc. from its contents.

    A typical solution is to handle manipulations from within the HTML.

    I have not tried it, but you may be able to get CoreWindow pointer events and hook them up to a GestureRecognizer

    Friday, October 24, 2014 1:58 PM
    Owner