Examples

Here we set up a GestureRecognizer object with a collection of input event handlers for processing various pointer and gestures. For more information on how to listen to and handle Windows Runtime events, see .

Remove the event handler and set the gesture recognizer to null if it is no longer needed:

gr.removeEventListener('MSPointerDown', pointerDown);
gr = null;

this._gestureRecognizer = null;

Remarks

You can create a gesture object for each appropriate element when your app starts. However, this approach might not scale well depending on the number of gesture objects you need to create (for example, a jigsaw puzzle with hundreds of pieces).

In this case, you can create gesture objects dynamically on a pointerdown event and destroy them on an MSGestureEnd event. This approach scales well, but does incur some overhead due to creating and releasing these objects.

Alternatively, you can statically allocate and dynamically manage a pool of reusable gesture objects.

For more detail on how to use cross-slide functionality, see Guidelines for cross-slide. The threshold distances used by the cross-slide interaction are shown in the following diagram.

The PivotRadius and PivotCenter properties are used only when single pointer input is detected. They have no effect on multiple pointer input. The value for these properties should be updated regularly during the interaction.

Remarks

CrossSlideExactCrossSlideExactCrossSlideExactCrossSlideExact

Gets or sets a value that indicates whether the exact distance from initial contact to end of the cross-slide interaction is reported.By default, a small distance threshold is subtracted from the first position reported by the system for cross-slide interactions. If this flag is set, the distance threshold is not subtracted from the initial position.

Note

This distance threshold is intended to account for any slight movement of the contact after initial detection. It helps the system differentiate between cross-sliding and panning, and helps ensure that a tap gesture is not interpreted as either.

ManipulationExactManipulationExactManipulationExactManipulationExact

Gets or sets a value that indicates whether the exact distance from initial contact to end of the interaction is reported.By default, a small distance threshold is subtracted from the first delta reported by the system. This distance threshold is intended to account for slight movements of the contact when processing a tap gesture. If this flag is set, the distance threshold is not subtracted from the first delta.

Methods

Identifies whether a tap can still be interpreted as the second tap of a double tap gesture.

public : PlatForm::Boolean CanBeDoubleTap(PointerPoint value)public bool CanBeDoubleTap(PointerPoint value)Public Function CanBeDoubleTap(value As PointerPoint) As bool// You can use this method in JavaScript.

Processes pointer input and raises the GestureRecognizer events appropriate to a pointer down action for the gestures and manipulations specified by the GestureSettings property.

public : void ProcessDownEvent(PointerPoint value)public void ProcessDownEvent(PointerPoint value)Public Function ProcessDownEvent(value As PointerPoint) As void// You can use this method in JavaScript.

Processes pointer input and raises the GestureRecognizer events appropriate to a pointer move action for the gestures and manipulations specified by the GestureSettings property.

public : void ProcessMoveEvents(IVector<PointerPoint> value)public void ProcessMoveEvents(IList<PointerPoint> value)Public Function ProcessMoveEvents(value As IList<PointerPoint>) As void// You can use this method in JavaScript.

Events

CrossSlidingCrossSlidingCrossSlidingCrossSliding

Occurs when a user performs a slide or swipe gesture (through a single touch contact) within a content area that supports panning along a single axis only. The gesture must occur in a direction that is perpendicular to this panning axis.

Note

A swipe is a short sliding gesture that results in a selection action while the longer slide gesture crosses a distance threshold and results in a rearrange action. The swipe and slide gestures are demonstrated in the following diagram.

public : event TypedEventHandler CrossSliding<GestureRecognizer, CrossSlidingEventArgs>public event TypedEventHandler CrossSliding<GestureRecognizer, CrossSlidingEventArgs>Public Event CrossSliding<GestureRecognizer, CrossSlidingEventArgs>// You can use this event in JavaScript.

Occurs when all contact points are lifted during a manipulation and the velocity of the manipulation is significant enough to initiate inertia behavior (translation, expansion, or rotation continue after the input pointers are lifted).

public : event TypedEventHandler ManipulationInertiaStarting<GestureRecognizer, ManipulationInertiaStartingEventArgs>public event TypedEventHandler ManipulationInertiaStarting<GestureRecognizer, ManipulationInertiaStartingEventArgs>Public Event ManipulationInertiaStarting<GestureRecognizer, ManipulationInertiaStartingEventArgs>// You can use this event in JavaScript.

Remarks

Inertia is the tendency of an object to resist any change in its state of rest or its velocity.

This event is raised before inertia processing.

Inertia behavior for this manipulation can be customized in the handler for this event. For example, inertia can be set to end after a specific distance or UI is displayed.