Erweitern Minimieren
Dieser Artikel wurde noch nicht bewertet - Dieses Thema bewerten.

GestureRecognizer Class

Stellt Gesten- und Manipulationserkennung bereit sowie Ereignislistener und Einstellungen.

Syntax


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

Attribute

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

Member

Der GestureRecognizerKlasse hat die folgenden Arten von Mitgliedern:

Konstruktoren

Der GestureRecognizerKlasse hat die folgenden Konstruktoren.

KonstruktorBeschreibung
GestureRecognizer Initializes a new instance of a GestureRecognizer object.

 

Ereignisse

Der GestureRecognizerKlasse hat die folgenden Ereignisse.

EreignisBeschreibung
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.

 

Methoden

The GestureRecognizer Klasse verfügt über die folgenden Methoden. Mit C#, Visual Basic und C++ erbt er außerdem Methoden von Object Klasse.

MethodeBeschreibung
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.

 

Eigenschaften

GestureRecognizerKlasse hat die folgenden Eigenschaften.

EigenschaftZugriffstypBeschreibung

AutoProcessInertia

Lese-/SchreibzugriffGets or sets a value that indicates whether manipulations during inertia are generated automatically.

CrossSlideExact

Lese-/SchreibzugriffGets 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

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

CrossSlideThresholds

Lese-/SchreibzugriffGets or sets values that indicate the distance thresholds for a CrossSliding interaction.

GestureSettings

Lese-/SchreibzugriffGets or sets a value that indicates the gesture and manipulation settings supported by an application.

InertiaExpansion

Lese-/SchreibzugriffGets 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

Lese-/SchreibzugriffGets 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

Lese-/SchreibzugriffGets 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

Lese-/SchreibzugriffGets 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

Lese-/SchreibzugriffGets 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

Lese-/SchreibzugriffGets 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

SchreibgeschütztGets a value that indicates whether an interaction is being processed.

IsInertial

SchreibgeschütztGets a value that indicates whether a manipulation is still being processed during inertia (no input points are active).

ManipulationExact

Lese-/SchreibzugriffGets 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

SchreibgeschütztGets a set of properties that are associated with the wheel button of a mouse device.

PivotCenter

Lese-/SchreibzugriffGets or sets the center point for a rotation interaction when single pointer input is detected.

PivotRadius

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

ShowGestureFeedback

Lese-/SchreibzugriffGets or sets a value that indicates whether visual feedback is displayed during an interaction.

 

Anmerkungen

Wir empfehlen die folgenden Techniken zum Behandeln von GestureRecognizer-Ereignissen:

  • Verwenden Sie die target- oder currentTarget-Eigenschaft des Ereignisobjekts anstelle des GestureRecognizer-Objekts im Ereignishandler:

    Der folgende Pseudocode zeigt, wie Sie einen generischen Ereignishandler für ein GestureRecognizer-Objekt einrichten können.

    
    function initialize() 
    {
      myGestureRecognizer = new Windows.UI.Input.GestureRecognizer();
    
      myGestureRecognizer.addEventListener('someevent', that.someeventhandler);
    }
    
    function someeventhandler = function (ev) {
        ev.target.somemethod();
    }
    
  • Legen Sie den Ereignishandler auf NULL fest, wenn er nicht mehr benötigt wird:
    
    myGestureRecognizer.someeventhandler = null;
    

Weitere Informationen zum Erkennen und Bearbeiten von Windows Runtime-Ereignissen finden Sie unter Verwenden von Windows-Runtime in JavaScript.

Hinweis  : Es handelt sich nicht um eine agile Klasse. Daher müssen Sie das Threadingmodell und das Marshallingverhalten berücksichtigen. Weitere Informationen finden Sie unter Threading und Marshalling (C++/CX) und Die Verwendung von Windows-Runtime-Objekten in einer Multithreaded-Umgebung (.NET).

Windows Phone 8

Diese API wird nicht implementiert und löst beim Aufruf eine Ausnahme aus.

Beispiele

Das folgende Beispiel zeigt, wie ein GestureRecognizer-Objekt erstellt wird und dann durch die GestureSettings-Eigenschaft Manipulations- und Gestenereignisse für dieses Objekt aktiviert werden.


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

Anforderungen

Unterstützte Mindestversion (Client)

Windows 8 [Nur Windows Store-Apps]

Unterstützte Mindestversion (Server)

Windows Server 2012 [Nur Windows Store-Apps]

Unterstützte Mindestversion (Telefon)

Windows Phone 8

Namespace

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

Metadaten

Windows.winmd

Weitere Informationen

Windows.UI.Input-Klassen
Verwenden von Windows-Runtime in JavaScript
Eingabe: Beispiel für Manipulationen und Gesten mit C++

 

 

© 2013 Microsoft. Alle Rechte vorbehalten.