处理2,3,4,5个指头螺纹,DoubleTap,控股手势在WinRT的应用(Handling 2,

2019-08-01 17:43发布

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?

Answer 1:

你必须与被上指针的事件传递(即追问下,进入,释放等)的PointerRoutedEventArgs工作,做硬盘的方式

每当指针进入控制被分配一个唯一的指针ID.I将创建一个字典,并且每个指针,因为它被压在控制(并且当它们退出显然删除它们)添加到该字典。 然后在你现有的抽头,抽头双和这样的处理只是检查有多少指针是在你的字典,并调用相应的处理程序



文章来源: Handling 2, 3, 4, 5 Fingers Tapped, DoubleTap & Holding Gestures in WinRT App