wp7 水平滑动选择 [英] wp7 horizontal swipe selection

查看:24
本文介绍了wp7 水平滑动选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个控件,它允许我在项目列表中滑动.水平滑动将在下一个和上一个项目之间移动.该控件还将确保所选项目在不被操纵时移动到中心.此控件仅占页面的一半,我希望左侧和右侧的选项可见并环绕.

I'm looking for a control that allows me to swipe through a list of items. Swiping horizontally would move between the next and previous items. The control would also ensure the selected item is moved to the center when not being manipulated. This control will only take up half of the page and I'd like the options to the left and right to be visible and wrap around.

像这样

  <-->
*][**][*

所以我的问题是,像这样的控件是否已经存在,如果存在,它叫什么?

So my question is, does a control like this already exists and if so what is it called?

推荐答案

如果您使用 Silverlight 中的 GestureService,这将非常容易工具包.只需为 Flick 事件实现一个处理程序,并分析目录和速度.

This is super easy if you use the GestureService from the Silverlight Toolkit. Simply implement a handler for the Flick event, and analyse the directory and velocity.

XAML

<toolkit:GestureService.GestureListener>
    <toolkit:GestureListener Flick="GestureListener_Flick" />
</toolkit:GestureService.GestureListener>

C#

private void GestureListener_Flick(object sender, FlickGestureEventArgs e)
{
    if (e.Direction == System.Windows.Controls.Orientation.Horizontal)
    {
        if (e.HorizontalVelocity < 0)
        {
            // flick right
        }
        else
        {
            // flick left
        }
    }
    else
    {
        if (e.VerticalVelocity < 0)
        {
            // flick up
        }
        else
        {
            // flick down
        }
    }
}

这篇关于wp7 水平滑动选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆