2010-09-10 7 views

Répondre

0

Le lien suivant est comment recevoir tactile Gestures messages Win32 en utilisant « WndProc » mais l'échantillon est en C++

http://msdn.microsoft.com/en-us/library/windows/desktop/dd371578(v=vs.85).aspx

Une autre méthode consiste à mettre en œuvre en fait un geste Tap-Attente à l'aide d'un simple « DispatcherTimer "qui devrait commencer lorsque" ScatterViewItem "est touché dans le gestionnaire d'événements" PreviewTouchDown "de l'élément sur lequel vous voulez appliquer le geste.

void OnPreviewTouchDown(object sender, System.Windows.Input.TouchEventArgs e) 
{ 
if(e.Source.GetHashCode() == YourUIElement.GetHashCode()) 
{ 
MyTimer.Start(); 

//You need to capture the touch before the ScatterViewItem handles its own touch which will  
//block you from receiving the touch up event 
YourUIElement.CaptureTouch(e.TouchDevice); 
e.Handled = true; 

} 
} 

void OnPreviewTouchUp(object sender, System.Windows.Input.TouchEventArgs e) 
{ 
YourUIElement.ReleaseAllTouches(); 
} 


private void OnTimerTick(object sender, EventArgs e) 
{ 
// To call whatever function or do whatever action you need. 
IsTapHoldGestureOkay = true; 
DoStuff(); 
MyTimer.Stop(); 
} 
0
TouchExtensions.AddTapGestureHandler(your_object_that_willdetect, your_handler_function); 

un peu en retard, mais pas de mal =)