Informations
Le sujet que vous avez demandé est indiqué ci-dessous. Toutefois, ce sujet ne figure pas dans la bibliothèque.

GestureRecognizer Class

Reconnaît les mouvements et les manipulations, les écouteurs d'événements et les paramètres.

Syntaxe


var gestureRecognizer = new Windows.UI.Input.GestureRecognizer();

Attributs

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

Membres

GestureRecognizerClasse comporte les types de membres suivants :

Constructeurs

GestureRecognizerClasse comporte les constructeurs suivants.

ConstructeurDescription
GestureRecognizer Initializes a new instance of a GestureRecognizer object.

 

Événements

GestureRecognizerClasse comporte les événements suivants.

ÉvénementDescription
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.

 

Méthodes

The GestureRecognizer Classe comporte les méthodes suivantes. Avec C#, Visual Basic et C++, il hérite également des méthodes de Object Classe.

MéthodeDescription
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.

 

Propriétés

Le GestureRecognizerClasse contient les propriétés suivantes.

PropriétéType d’accèsDescription

AutoProcessInertia

en lecture/écritureGets or sets a value that indicates whether manipulations during inertia are generated automatically.

CrossSlideExact

en lecture/écritureGets 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

en lecture/écritureGets or sets a value that indicates whether the cross-slide axis is horizontal.

CrossSlideThresholds

en lecture/écritureGets or sets values that indicate the distance thresholds for a CrossSliding interaction.

GestureSettings

en lecture/écritureGets or sets a value that indicates the gesture and manipulation settings supported by an application.

InertiaExpansion

en lecture/écritureGets 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

en lecture/écritureGets 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

en lecture/écritureGets 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

en lecture/écritureGets 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

en lecture/écritureGets 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

en lecture/écritureGets 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

en lecture seuleGets a value that indicates whether an interaction is being processed.

IsInertial

en lecture seuleGets a value that indicates whether a manipulation is still being processed during inertia (no input points are active).

ManipulationExact

en lecture/écritureGets 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

en lecture seuleGets a set of properties that are associated with the wheel button of a mouse device.

PivotCenter

en lecture/écritureGets or sets the center point for a rotation interaction when single pointer input is detected.

PivotRadius

en lecture/écritureGets or sets the radius, from the PivotCenter to the pointer input, for a rotation interaction when single pointer input is detected.

ShowGestureFeedback

en lecture/écritureGets or sets a value that indicates whether visual feedback is displayed during an interaction.

 

Remarques

Nous vous recommandons les techniques suivantes pour gérer les événements GestureRecognizer :

  • Utilisez la propriété target ou currentTarget de l'objet événement à la place de l'objet GestureRecognizer dans le gestionnaire d'événements :

    le pseudo-code suivant montre comment vous pouvez installer un gestionnaire d'événements générique pour un objet GestureRecognizer.

    
    function initialize() 
    {
      myGestureRecognizer = new Windows.UI.Input.GestureRecognizer();
    
      myGestureRecognizer.addEventListener('someevent', that.someeventhandler);
    }
    
    function someeventhandler = function (ev) {
        ev.target.somemethod();
    }
    
  • Définissez le gestionnaire d'événements sur null s'il n'est plus nécessaire :
    
    myGestureRecognizer.someeventhandler = null;
    

Pour plus d'informations sur l'écoute et la gestion des événements Windows Runtime, consultez Utilisation de Windows Runtime dans JavaScript.

Remarque   : cette classe n'est pas agile, ce qui signifie que vous devez prendre en compte son modèle de thread et son comportement de marshaling. Pour plus d'informations, consultez Threads et marshaling (C++/CX) et Utilisation d'objets Windows Runtime dans un environnement multithread (.NET).

Windows Phone 8

Cette API n'est pas implémentée et lève une exception si elle est appelée.

Exemples

L'exemple suivant montre comment créer un objet GestureRecognizer puis activer les événements de manipulation et de mouvement sur cet objet via la propriété GestureSettings.


// 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;

Configuration requise

Client minimal pris en charge

Windows 8 [Applications du Windows Store uniquement]

Serveur minimal pris en charge

Windows Server 2012 [Applications du Windows Store uniquement]

Téléphone minimal pris en charge

Windows Phone 8

Espace de noms

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

Métadonnées

Windows.winmd

Voir aussi

Classes Windows.UI.Input
Utilisation de Windows Runtime en JavaScript
Entrée : exemple de manipulations et de mouvements à l'aide de C++

 

 

Afficher:
© 2014 Microsoft