9

I can easily handle 1 finger Tapped, DoubleTap and Holding gestures like this:

public MainPage()
{
    this.InitializeComponent();
    this.Tapped += mc_Tapped;
    this.DoubleTapped += mc_DoubleTapped;
    this.Holding += mc_Holding;
}
public void mc_Tapped(object sender, TappedRoutedEventArgs e)
{
    //Tap
}
public void mc_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
    //DoubleTap
}
public void mc_Holding(object sender, HoldingRoutedEventArgs e)
{
    //Hold
}

But the events don't have a property to get the number of fingers and they don't even get fired when more than 1 touch contact is present on the screen. I also want to handle 2, 3, 4, 5 fingers Tapped, DoubleTap and Holding gestures. Can anyone tell me how to do that?

4

1 回答 1

4

您必须使用在 Pointer 事件(即按下、输入、释放等)上传递的 PointerRoutedEventArgs 并以艰难的方式完成

每次指针进入控件时都会分配一个唯一的指针 ID。我会创建一个字典,并在控件上按下时将每个指针添加到该字典(并且在它们退出时显然将它们删除)。然后在您现有的点击、双击和此类处理程序中,只需检查字典中有多少指针并调用适当的处理程序

于 2012-10-23T11:50:08.757 回答