2012-04-10 56 views
1

我想在我的代码中使用拖动手势。但不幸的是,它不工作。以下是我正在使用的代码片段。它有什么问题吗?如果是的话,帮助我。wp7 xna手势不起作用

TouchPanel.EnabledGestures = GestureType.DragComplete | GestureType.Tap | GestureType.Pinch | GestureType.FreeDrag; 
while (TouchPanel.IsGestureAvailable) 
{ 
    GestureSample gesture = TouchPanel.ReadGesture(); 

    if (gesture.GestureType == GestureType.DragComplete) 
    { 
     // do something     
    } 
} 
+0

什么不工作?试过调试? – Reniuz 2012-04-10 12:25:03

+0

那么,什么是问题? – 2012-04-10 12:47:06

+0

拖动事件未被检测到! – 2012-04-11 06:17:34

回答

0
TouchPanel.EnabledGestures = GestureType.Tap | GestureType.DragComplete; 
      foreach (GestureSample gestureSample in input.Gestures) 
      { 
       if (gestureSample.GestureType == GestureType.Tap) 
       { 
        Debug.WriteLine("tapped "); 
       } 
       else if (gestureSample.GestureType == GestureType.DragComplete) 
       { 
        Debug.WriteLine("dragged"); 
       } 
      } 
+0

其工作正常 – 2012-06-19 05:36:31

+0

whats input.Gestures @sunil_divum? – Gabson 2013-11-14 13:53:13