locked
How to add MSGesture Event to listview

    Question

  • I was trying to add MSGesture Event to my listview to track the finger swipe on the listview.

    Below is the code I used to create the listview.

    var elem = document.createElement('div');

    elem.id = 'mylist';

    var lv = new WinJS.UI.ListView(elem, {        });

    Then I tried the following code to hook up the event handler

    var list = document.getElementById("mylist");

    list .addEventListener("MSGestureEnd", eventhandler, false);

    var myGesture = new MSGesture();
    myGesture .target = list ;

    However the event never got fired.

    Any idea how to make this working?

    Thanks a lot!

    Friday, September 28, 2012 6:59 PM

All replies

  • Hello, I think that the correct code is

    var list = document.getElementById("mylist");
    
    list .addEventListener("MSGestureEnd", eventhandler, false);
    
    var myGesture = new MSGesture();
    myGesture.target = list;
    myGesture.srcElt = list;
    list.gesture = myGesture;                  
    list.gesture.pointerType = null;

    • Proposed as answer by geovanneb Wednesday, October 10, 2012 7:53 PM
    Tuesday, October 02, 2012 7:01 PM
  • Still doesn't work :(

    Thursday, November 01, 2012 7:05 AM