UIElement.ManipulationDelta UIElement.ManipulationDelta UIElement.ManipulationDelta UIElement.ManipulationDelta Event

定義

操作中に入力デバイスが位置を変更したときに発生します。Occurs when the input device changes position during a manipulation.

public:
 event EventHandler<System::Windows::Input::ManipulationDeltaEventArgs ^> ^ ManipulationDelta;
public event EventHandler<System.Windows.Input.ManipulationDeltaEventArgs> ManipulationDelta;
member this.ManipulationDelta : EventHandler<System.Windows.Input.ManipulationDeltaEventArgs> 
Public Custom Event ManipulationDelta As EventHandler(Of ManipulationDeltaEventArgs) 

次の例は、イベント ハンドラーをManipulationDeltaイベント。The following example shows an event handler for the ManipulationDelta event. この例では、DeltaManipulationプロパティを移動、サイズ変更、および回転をRectangleします。The example uses the DeltaManipulation property to move, resize, and rotate a Rectangle. また、例を確認するかどうか、ManipulationDelta慣性と四角形は、ウィンドウの端をタッチするかどうかの中にイベントが発生しました。The example also checks whether the ManipulationDelta event occurred during inertia and whether the rectangle is touching the edge of a window. そのような場合に該当する場合、アプリケーションは、四角形のアプリケーションの可視領域を離れることを防ぐために操作を停止します。If those cases are true, the application stops the manipulation to prevent the rectangle from leaving the visible area of the application. この例の例ではチュートリアル。初めてのタッチ アプリケーションを作成するします。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

注釈

ManipulationDeltaイベントには複数回が発生したときに、ユーザーがドラッグした本の指画面上で、操作中に、もう一度慣性による処理が発生したとき。The ManipulationDelta event occurs multiple times when the user drags fingers over the screen during a manipulation and again when inertia occurs. 使用することができます、IsInertial慣性による処理中に、イベントが発生しているかどうかを確認するプロパティ。You can use the IsInertial property to check whether the event is occurring during inertia.

要素でManipulationDeltaイベント発生イベントが発生したときに何らかの方法では影響しません。The element on with ManipulationDelta event occurs is not affected in any way when the event occurs. 操作される要素にロジックを提供する必要があります。You must provide the logic to the element that is to be manipulated. CumulativeManipulationDeltaManipulationのプロパティの型はManipulationDelta操作の位置を変更する方法についてのデータが含まれ、移動、サイズ変更、またはオブジェクトの回転として解釈されます。The CumulativeManipulation and DeltaManipulation properties, which are of type ManipulationDelta, contain data about how the position of the manipulations change and interpreted as moving, resizing, or rotating an object. 操作される要素には、その情報を適用します。You apply that information to the element that is to be manipulated.

操作の詳細については、次を参照してください。、入力の概要します。For more information about manipulations, see the Input Overview. 操作に応答するアプリケーションの例は、次を参照してください。チュートリアル。初めてのタッチ アプリケーションを作成するします。For an example of an application that responds to manipulations, see Walkthrough: Creating Your First Touch Application.

ルーティングされたイベント情報Routed Event Information

識別子フィールドです。Identifier field ManipulationDeltaEvent
ルーティング方法Routing strategy バブルBubbling
DelegateDelegate EventHandler<TEventArgs> 型の ManipulationDeltaEventArgsEventHandler<TEventArgs> of type ManipulationDeltaEventArgs.

適用対象