theEternalStudent
theEternalStudent

Reputation: 74

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.

Upvotes: 0

Views: 390

Answers (1)

Amit Bhatiya
Amit Bhatiya

Reputation: 2621

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)
    {
    }
 }

Upvotes: 1

Related Questions