Windows 8商店应用 - 滑动手势进行导航

时间:2013-12-13 10:22:00

标签: c# windows-8 microsoft-metro

我正在搜索解决方案,通过"轻扫" -gestures在我的主页和子页面之间导航。

ATM返回的唯一方法是后退按钮,但检测左侧的滑动以导航回主页会很不错。

我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:2)

您必须使用操纵事件。看看here

向左滑动的示例:

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();
        }
    }
}