ManipulationDelta Klasse

Definition

Enthält Transformationsdaten, die gesammelt werden, wenn Manipulationsereignisse auftreten.

public ref class ManipulationDelta
public class ManipulationDelta
type ManipulationDelta = class
Public Class ManipulationDelta
Vererbung
ManipulationDelta

Beispiele

Das folgende Beispiel zeigt einen Ereignishandler für das ManipulationDelta Ereignis. Im Beispiel werden die TranslationEigenschaften zum ScaleRotation Verschieben, Ändern der Größe und Drehung eines RectangleSteuerelements angewendet. Dieses Beispiel ist Teil eines größeren Beispiels 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

Hinweise

Die ManipulationDelta Klasse enthält Informationen zu den Änderungen an der Position einer Manipulation. Windows Presentation Foundation (WPF) interpretiert die Änderungen als ein Translation, Expansionoder Rotation. Wenn das ManipulationDelta Ereignis für ein UIElementEreignis auftritt, verwenden Sie die Eigenschaften eines ManipulationDelta Objekts, um das Objekt zu transformieren, das bearbeitet werden soll. Die ManipulationDeltaEventArgs Klasse stellt zwei Eigenschaften vom Typ : DeltaManipulationManipulationDeltaund CumulativeManipulation.

Weitere Informationen zu Manipulationen finden Sie in der Eingabeübersicht. Ein Beispiel für eine Anwendung, die auf Manipulationen reagiert, finden Sie unter Walkthrough: Creating Your First Touch Application.

Konstruktoren

Name Beschreibung
ManipulationDelta(Vector, Double, Vector, Vector)

Initialisiert eine neue Instanz der ManipulationDelta-Klasse.

Eigenschaften

Name Beschreibung
Expansion

Dient zum Abrufen oder Festlegen der Größe der Manipulation in geräteunabhängigen Einheiten (1/96. Zoll pro Einheit).

Rotation

Ruft die Drehung der Manipulation in Grad ab oder legt sie fest.

Scale

Ruft den Betrag ab, der die Größe der Manipulation als Multiplikator geändert hat, oder legt diese fest.

Translation

Ruft die lineare Bewegung der Manipulation ab oder legt sie fest.

Methoden

Name Beschreibung
Equals(Object)

Bestimmt, ob das angegebene Objekt dem aktuellen Objekt entspricht.

(Geerbt von Object)
GetHashCode()

Dient als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft die Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie der aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Gilt für: