ManipulationDeltaEventArgs ManipulationDeltaEventArgs ManipulationDeltaEventArgs ManipulationDeltaEventArgs Class

Definición

Proporciona datos para el evento ManipulationDelta.Provides data for the ManipulationDelta event.

public ref class ManipulationDeltaEventArgs sealed : System::Windows::Input::InputEventArgs
public sealed class ManipulationDeltaEventArgs : System.Windows.Input.InputEventArgs
type ManipulationDeltaEventArgs = class
    inherit InputEventArgs
Public NotInheritable Class ManipulationDeltaEventArgs
Inherits InputEventArgs
Herencia

Ejemplos

En el ejemplo siguiente se muestra un controlador de ManipulationDelta eventos para el evento.The following example shows an event handler for the ManipulationDelta event. En el ejemplo se DeltaManipulation usa la propiedad para desplazar, cambiar el Rectangletamaño y girar un.The example uses the DeltaManipulation property to move, resize, and rotate a Rectangle. En el ejemplo también se comprueba ManipulationDelta si el evento se produjo durante la inercia y si el rectángulo toca el borde de una ventana.The example also checks whether the ManipulationDelta event occurred during inertia and whether the rectangle is touching the edge of a window. Si esos casos son true, la aplicación detiene la manipulación para evitar que el rectángulo deje el área visible de la aplicación.If those cases are true, the application stops the manipulation to prevent the rectangle from leaving the visible area of the application. Este ejemplo forma parte de un ejemplo más grande en el tutorial: Crear la primera aplicacióntáctil.This example is part of a larger example in Walkthrough: Creating Your First Touch Application.

void Window_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
    
    // Get the Rectangle and its RenderTransform matrix.
    Rectangle rectToMove = e.OriginalSource as Rectangle;
    Matrix rectsMatrix = ((MatrixTransform)rectToMove.RenderTransform).Matrix;

    // Rotate the Rectangle.
    rectsMatrix.RotateAt(e.DeltaManipulation.Rotation, 
                         e.ManipulationOrigin.X, 
                         e.ManipulationOrigin.Y);

    // Resize the Rectangle.  Keep it square 
    // so use only the X value of Scale.
    rectsMatrix.ScaleAt(e.DeltaManipulation.Scale.X, 
                        e.DeltaManipulation.Scale.X, 
                        e.ManipulationOrigin.X,
                        e.ManipulationOrigin.Y);

    // Move the Rectangle.
    rectsMatrix.Translate(e.DeltaManipulation.Translation.X,
                          e.DeltaManipulation.Translation.Y);

    // Apply the changes to the Rectangle.
    rectToMove.RenderTransform = new MatrixTransform(rectsMatrix);

    Rect containingRect =
        new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);

    Rect shapeBounds =
        rectToMove.RenderTransform.TransformBounds(
            new Rect(rectToMove.RenderSize));

    // Check if the rectangle is completely in the window.
    // If it is not and intertia is occuring, stop the manipulation.
    if (e.IsInertial && !containingRect.Contains(shapeBounds))
    {
        e.Complete();
    }

    
    e.Handled = true;
}
Private Sub Window_ManipulationDelta(ByVal sender As Object, ByVal e As ManipulationDeltaEventArgs)

    ' Get the Rectangle and its RenderTransform matrix.
    Dim rectToMove As Rectangle = e.OriginalSource
    Dim rectTransform As MatrixTransform = rectToMove.RenderTransform
    Dim rectsMatrix As Matrix = rectTransform.Matrix


    ' Rotate the shape
    rectsMatrix.RotateAt(e.DeltaManipulation.Rotation,
                         e.ManipulationOrigin.X,
                         e.ManipulationOrigin.Y)

    ' Resize the Rectangle. Keep it square 
    ' so use only the X value of Scale.
    rectsMatrix.ScaleAt(e.DeltaManipulation.Scale.X,
                        e.DeltaManipulation.Scale.X,
                        e.ManipulationOrigin.X,
                        e.ManipulationOrigin.Y)

    'move the center
    rectsMatrix.Translate(e.DeltaManipulation.Translation.X,
                          e.DeltaManipulation.Translation.Y)

    ' Apply the changes to the Rectangle.
    rectTransform = New MatrixTransform(rectsMatrix)
    rectToMove.RenderTransform = rectTransform

    Dim container As FrameworkElement = e.ManipulationContainer
    Dim containingRect As New Rect(container.RenderSize)

    Dim shapeBounds As Rect = rectTransform.TransformBounds(
                                New Rect(rectToMove.RenderSize))

    ' Check if the rectangle is completely in the window.
    ' If it is not and intertia is occuring, stop the manipulation.
    If e.IsInertial AndAlso Not containingRect.Contains(shapeBounds) Then
        e.Complete()
    End If

    e.Handled = True
End Sub

Comentarios

La ManipulationDeltaEventArgs clase contiene datos sobre los cambios en la posición de una manipulación.The ManipulationDeltaEventArgs class contains data about changes in the position of a manipulation. La DeltaManipulation propiedad contiene los cambios que se produjeron desde ManipulationDelta que se produjo el último evento.The DeltaManipulation property contains the changes that occurred since the last ManipulationDelta event occurred. La CumulativeManipulation propiedad contiene los cambios totales que se han producido para la manipulación actual.The CumulativeManipulation property contains the total changes that occurred for the current manipulation. Utilice una de esas propiedades para transformar el objeto manipulado.You use one of those properties to transform the manipulated object.

Puede finalizar una manipulación si llama Complete al método o fuerza la manipulación en la inercia llamando al StartInertia método.You can end a manipulation by calling the Complete method or force the manipulation into inertia by calling the StartInertia method.

Propiedades

CumulativeManipulation CumulativeManipulation CumulativeManipulation CumulativeManipulation

Obtiene los cambios acumulados de la manipulación actual.Gets the cumulated changes of the current manipulation.

DeltaManipulation DeltaManipulation DeltaManipulation DeltaManipulation

Obtiene los cambios más recientes de la manipulación actual.Gets the most recent changes of the current manipulation.

Device Device Device Device

Obtiene el dispositivo de entrada que inició este evento.Gets the input device that initiated this event.

(Inherited from InputEventArgs)
Handled Handled Handled Handled

Obtiene o establece un valor que indica el estado actual del control de eventos para un evento enrutado cuando recorre la ruta.Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.

(Inherited from RoutedEventArgs)
IsInertial IsInertial IsInertial IsInertial

Obtiene un valor que indica si el evento ManipulationDelta se produce durante inercia.Gets a value that indicates whether the ManipulationDelta event occurs during inertia.

ManipulationContainer ManipulationContainer ManipulationContainer ManipulationContainer

Obtiene el contenedor que define las coordenadas para la manipulación.Gets the container that defines the coordinates for the manipulation.

ManipulationOrigin ManipulationOrigin ManipulationOrigin ManipulationOrigin

Obtiene el punto en el que se origina la manipulación.Gets the point from which the manipulation originated.

Manipulators Manipulators Manipulators Manipulators

Obtiene una colección de objetos que representa los contactos táctiles para la manipulación.Gets a collection of objects that represents the touch contacts for the manipulation.

OriginalSource OriginalSource OriginalSource OriginalSource

Obtiene el origen inicial de los informes determinado por pruebas de acceso puro, antes de que una clase primaria realice posibles ajustes de Source.Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class.

(Inherited from RoutedEventArgs)
RoutedEvent RoutedEvent RoutedEvent RoutedEvent

Obtiene o establece el RoutedEvent asociado a esta instancia RoutedEventArgs.Gets or sets the RoutedEvent associated with this RoutedEventArgs instance.

(Inherited from RoutedEventArgs)
Source Source Source Source

Obtiene o establece una referencia al objeto que generó el evento.Gets or sets a reference to the object that raised the event.

(Inherited from RoutedEventArgs)
Timestamp Timestamp Timestamp Timestamp

Obtiene la hora a la que se produjo este evento.Gets the time when this event occurred.

(Inherited from InputEventArgs)
Velocities Velocities Velocities Velocities

Obtiene la velocidad de los cambios más recientes que se producen en la manipulación.Gets the rates of the most recent changes to the manipulation.

Métodos

Cancel() Cancel() Cancel() Cancel()

Cancela la manipulación.Cancels the manipulation.

Complete() Complete() Complete() Complete()

Completa la manipulación sin inercia.Completes the manipulation without inertia.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
InvokeEventHandler(Delegate, Object) InvokeEventHandler(Delegate, Object) InvokeEventHandler(Delegate, Object) InvokeEventHandler(Delegate, Object)

Invoca los controladores de eventos de una manera específica del tipo, lo que puede aumentar la eficacia del sistema de eventos.Invokes event handlers in a type-specific way, which can increase event system efficiency.

(Inherited from InputEventArgs)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
OnSetSource(Object) OnSetSource(Object) OnSetSource(Object) OnSetSource(Object)

Cuando se invalida en una clase derivada, proporciona un punto de entrada de devolución de llamada de notificación cada vez que cambia el valor de propiedad Source de una instancia.When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes.

(Inherited from RoutedEventArgs)
ReportBoundaryFeedback(ManipulationDelta) ReportBoundaryFeedback(ManipulationDelta) ReportBoundaryFeedback(ManipulationDelta) ReportBoundaryFeedback(ManipulationDelta)

Especifica que la manipulación ha excedido ciertos límites.Specifies that the manipulation has gone beyond certain boundaries.

StartInertia() StartInertia() StartInertia() StartInertia()

Inicia la inercia en la manipulación omitiendo los movimientos de contacto subsiguientes y generando el evento ManipulationInertiaStarting.Starts inertia on the manipulation by ignoring subsequent contact movements and raising the ManipulationInertiaStarting event.

ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Se aplica a