GestureRecognizer class

Expand Minimize
0 out of 13 rated this helpful - Rate this topic

Provides gesture and manipulation recognition, event listeners, and settings.

Syntax


public ref class GestureRecognizer sealed : Object

Attributes

ActivatableAttribute(NTDDI_WIN8)
MarshalingBehaviorAttribute(None)
VersionAttribute(NTDDI_WIN8)

Members

The GestureRecognizer class has these types of members:

Constructors

The GestureRecognizer class has these constructors.

ConstructorDescription
GestureRecognizer Initializes a new instance of a GestureRecognizer object.

 

Events

The GestureRecognizer class has these events.

EventDescription
CrossSliding 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.
Dragging Occurs when a user performs a slide or swipe gesture with a mouse or pen/stylus (single contact).
Holding Occurs when a user performs a press and hold gesture (with a single touch, mouse, or pen/stylus contact).
ManipulationCompleted Occurs when the input points are lifted and all subsequent motion (translation, expansion, or rotation) through inertia has ended.
ManipulationInertiaStarting 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).
ManipulationStarted Occurs when one or more input points have been initiated and subsequent motion (translation, expansion, or rotation) has begun.
ManipulationUpdated Occurs after one or more input points have been initiated and subsequent motion (translation, expansion, or rotation) is under way.
RightTapped Occurs when the pointer input is interpreted as a right-tap gesture.
Tapped Occurs when the pointer input is interpreted as a tap gesture.

 

Methods

The GestureRecognizer class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
CanBeDoubleTap Identifies whether a tap can still be interpreted as the second tap of a double tap gesture.
CompleteGesture Causes the gesture recognizer to finalize an interaction.
ProcessDownEvent Processes pointer input and raises the GestureRecognizer events appropriate to a pointer down action for the gestures and manipulations specified by the GestureSettings property.
ProcessInertia Performs inertia calculations and raises the various inertia events.
ProcessMouseWheelEvent Processes pointer input and raises the GestureRecognizer events appropriate to a mouse wheel action for the gestures and manipulations specified by the GestureSettings property.
ProcessMoveEvents Processes pointer input and raises the GestureRecognizer events appropriate to a pointer move action for the gestures and manipulations specified by the GestureSettings property.
ProcessUpEvent Processes pointer input and raises the GestureRecognizer events appropriate to a pointer up action for the gestures and manipulations specified by the GestureSettings property.

 

Properties

The GestureRecognizer class has these properties.

PropertyAccess typeDescription

AutoProcessInertia

Read/writeGets or sets a value that indicates whether manipulations during inertia are generated automatically.

CrossSlideExact

Read/writeGets 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 a cross-slide interaction. If this flag is set, the distance threshold is not subtracted from the initial position.

CrossSlideHorizontally

Read/writeGets or sets a value that indicates whether the cross-slide axis is horizontal.

CrossSlideThresholds

Read/writeGets or sets values that indicate the distance thresholds for a CrossSliding interaction.

GestureSettings

Read/writeGets or sets a value that indicates the gesture and manipulation settings supported by an application.

InertiaExpansion

Read/writeGets or sets a value that indicates the relative change in size of an object from the start of inertia to the end of inertia (when resizing, or scaling, is complete).

InertiaExpansionDeceleration

Read/writeGets or sets a value that indicates the rate of deceleration from the start of inertia to the end of inertia (when the resizing, or expansion, manipulation is complete).

InertiaRotationAngle

Read/writeGets or sets a value that indicates the final angle of rotation of an object at the end of inertia (when the rotation manipulation is complete).

InertiaRotationDeceleration

Read/writeGets or sets a value that indicates the rate of deceleration from the start of inertia to the end of inertia (when the rotation manipulation is complete).

InertiaTranslationDeceleration

Read/writeGets or sets a value that indicates the rate of deceleration from the start of inertia to the end of inertia (when the translation manipulation is complete).

InertiaTranslationDisplacement

Read/writeGets or sets a value that indicates the relative change in the screen location of an object from the start of inertia to the end of inertia (when the translation manipulation is complete).

IsActive

Read-onlyGets a value that indicates whether an interaction is being processed.

IsInertial

Read-onlyGets a value that indicates whether a manipulation is still being processed during inertia (no input points are active).

ManipulationExact

Read/writeGets 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.

MouseWheelParameters

Read-onlyGets a set of properties that are associated with the wheel button of a mouse device.

PivotCenter

Read/writeGets or sets the center point for a rotation interaction when single pointer input is detected.

PivotRadius

Read/writeGets or sets the radius, from the PivotCenter to the pointer input, for a rotation interaction when single pointer input is detected.

ShowGestureFeedback

Read/writeGets or sets a value that indicates whether visual feedback is displayed during an interaction.

 

Remarks

We recommend the following techniques for handling GestureRecognizer events:

  • Use the target or currentTarget property of the event object instead of the GestureRecognizer object in the event handler:

    The following pseudocode shows how you might set up a generic event handler for a GestureRecognizer object.

    
    function initialize() 
    {
      myGestureRecognizer = new Windows.UI.Input.GestureRecognizer();
    
      myGestureRecognizer.addEventListener('someevent', that.someeventhandler);
    }
    
    function someeventhandler = function (ev) {
        ev.target.somemethod();
    }
    
  • Set the event handler to null if it is no longer needed:
    
    myGestureRecognizer.someeventhandler = null;
    

For more information on how to listen to and handle Windows Runtime events, see Using the Windows Runtime in JavaScript.

Note  : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Windows Phone 8

This API is not implemented and will throw an exception if called.

Examples

The following example demonstrates how to create a GestureRecognizer object and then enable manipulation and gesture events on that object through the GestureSettings property.


// Initialize gesture recognizer
        gr = new Windows.UI.Input.GestureRecognizer();

        // Configure GestureRecognizer to detect rotation, translation, and scaling,
        // inertia, and tap gesture
        gr.gestureSettings =
            Windows.UI.Input.GestureSettings.manipulationRotate |
            Windows.UI.Input.GestureSettings.manipulationTranslateX |
            Windows.UI.Input.GestureSettings.manipulationTranslateY |
            Windows.UI.Input.GestureSettings.manipulationScale |
            Windows.UI.Input.GestureSettings.manipulationRotateInertia |
            Windows.UI.Input.GestureSettings.manipulationScaleInertia |
            Windows.UI.Input.GestureSettings.manipulationTranslateInertia |
            Windows.UI.Input.GestureSettings.tap;

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

Windows.UI.Input
Windows::UI::Input [C++]

Metadata

Windows.winmd

See also

Windows.UI.Input Classes
Using the Windows Runtime in JavaScript
Input: manipulations and gestures using C++ sample

 

 

Build date: 2/25/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.