UIElement.ManipulationDelta 이벤트

정의

입력 디바이스에서 조작 중에 위치를 변경하면 발생합니다.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. ManipulationDelta형식인 CumulativeManipulationDeltaManipulation 속성은 조작의 위치가 개체 이동, 크기 조정 또는 회전으로 해석 되는 방법에 대 한 데이터를 포함 합니다.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
대리자Delegate EventHandler<TEventArgs> 형식의 ManipulationDeltaEventArgs입니다.EventHandler<TEventArgs> of type ManipulationDeltaEventArgs.

적용 대상