Events

TouchManager uses an event-based model to build the touch interface between the device and the application. The TouchManager's events can be separated logically in two categories by their type: basic touch events and gesture events.

Basic touch events

These events handle the basic interactions.

  • TouchEnter: Occurs when a touch input appears over the element. The event handler arguments are of type TouchEventArgs.

  • TouchDown: Occurs when a touch input appears over the element. The event handler arguments are of type TouchEventArgs.

  • TouchMove: Occurs when a touch input is moved along the bounds of the element. The event handler arguments are of type TouchEventArgs.

  • TouchUp: Occurs when a touch input leaves the element. The event handler arguments are of type TouchEventArgs.

  • TouchLeave: Occurs when a touch input leaves the element. The event handler arguments are of type TouchEventArgs.

The basic events are listed in the order of their invoking.

  • LostTouchCapture: Occurs when an element loses the touch capture. The event handler arguments are of type TouchEventArgs.

Gesture events

These events handle more complex gesture interactions that are combinations of basic touch events.

All predefined gestures are an interpretation of the five basic events. A gesture recognizer works only with the touch events it receives. When a gesture event is raised, say Swipe, it is during the TouchMove event of the element. This makes the Swipe to look as if it has a Bubbling routed strategy, but actually it has a Direct strategy. When the Swipe event is marked as handled, this automatically marks the TouchMove event as handled, preventing a parent element from receving the touch move event, hence preventing from Swipe being raised. In order to avoid gesture inconsistency accross different elements in nested scenarios, all Swipe related events need to be marked as handled - SwipeStarted, Swipe, SwipeFinished. Same rule applies to Drag and Pinch

  • Tap: Occurs when a tap gesture is executed on the element. The event handler arguments are of type TapEventArgs.

  • TapAndHold: Occurs when the user taps the element and hold their finger down. The event handler arguments are of type TouchEventArgs.

  • TapHoldAndRelease: Occurs when the user taps and holds the element for a moment and then touch up. The event handler arguments are of type TouchEventArgs.

  • SwipeStarted: Occurs when a swipe operation is started. The event handler arguments are of type TouchEventArgs.

  • Swipe: Occurs after the SwipeStarted event, while the swipe operation is running. The event handler arguments are of type SwipeEventArgs.

  • SwipeFinished: Occurs when the swipe operation finishes. The event handler arguments are of type TouchEventArgs.

  • SwipeInertiaStarted: Occurs when the touch input leaves the screen while the swipe operation is running. This event is fired after SwipeFinished. The event handler arguments are of type RadRoutedEventArgs.

  • SwipeInertia: Occurs after the SwipeInertiaStarted event while the swipe inertial operation is running. The event handler arguments are of type SwipeInertiaEventArgs.

    The SwipeInertia event won't be fired unless SwipeInertiaStarted is handled.

  • SwipeInertiaFinished: Occurs when the swipe inertia finishes. The event handler arguments are of type RadRoutedEventArgs.

  • PinchStarted: Occurs when a pinch operation starts. The event handler arguments are of type PinchEventArgs.

  • Pinch: Occurs while pinching is in action. The event handler arguments are of type PinchEventArgs.

  • PinchFinished: Occurs when the pinch operation ends. The event handler arguments are of type PinchEventArgs.

  • DragStarted: Occurs when a drag operation is started. The event handler arguments are of type TouchEventArgs.

  • Drag: Occurs when the drag operation is running. The event handler arguments are of type TouchEventArgs.

  • DragFinished: Occurs when the drag operation is finished. The event handler arguments are of type TouchEventArgs.

Subscribing for TouchManager events

The TouchManager expose public methods for all events that could be subscribed to. The following code snippet illustrates how to subscribe to the TouchManager events:

Example 1: Subscribing to TouchManager events

TouchManager.AddTapEventHandler(uiElement, new TapEventHandler(OnUIElementTap)); 
TouchManager.AddTouchDownEventHandler(uiElement, new TouchEventHandler(OnUIElementTouchDown)); 
//------------- 
private void OnUIElementTap(object sender, TapEventArgs args) 
{ 
} 
 
private void OnUIElementTouchDown(object sender, TouchEventArgs args) 
{        
} 
TouchManager.AddTapEventHandler(uiElement, New TapEventHandler(AddressOf OnUIElementTap)) 
TouchManager.AddTouchDownEventHandler(uiElement, New TouchEventHandler(AddressOf OnUIElementTouchDown))  
'--------------' 
Private Sub OnUIElementTap(sender As Object, args As TapEventArgs) 
End Sub 
 
Private Sub OnUIElementTouchDown(sender As Object, args As TouchEventArgs) 
End Sub 

See Also

In this article