Marc
Marc

Reputation: 171

Windows 8 store app - swipe gesture to navigate

i'm searching for a solution to navigate between my main and subpage via "swipe"-gestures.

ATM the only way to get back is the back button, but it would be nice to detect a swipe on the left to navigate back to the mainpage.

How can I achieve this?

Upvotes: 2

Views: 1132

Answers (1)

Max
Max

Reputation: 3593

You have to use the manipulation events. Take a look here.

Example for a left swipe:

Point start;

void ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e) {
    start = e.Position;
}

void ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) {
    if (e.IsInertial) {
        if (start.X - e.Position.X > 500) //swipe left
        {
            e.Complete();
        }
    }
}

Upvotes: 2

Related Questions