简体   繁体   中英

how to detect the horizontal change when swiping inside a pivot control in windows phone 8

I would like to detect the horizontal change when swiping inside a pivot control in windows phone 8 so that i can make changes to the collection bound to the control, like add or remove items when swiping left or right. I want something other than selectionchanged event as i am facing some problem there.

try this:

public TakeTourPage()
{
    InitializeComponent();
    GestureListener gestureListener = GestureService.GetGestureListener(ContentPanel);
    gestureListener.DragCompleted += gestureListener_DragCompleted;
}

void gestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
{

    // User flicked towards left
    if (e.HorizontalVelocity < 0)
    {
    }

    // User flicked towards right
    if (e.HorizontalVelocity > 0)
    {
    }
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM