Share via


ManipulationDeltaEventArgs.IsInertial Özellik

Tanım

Olayın eylemsizlik sırasında olup olmadığını ManipulationDelta gösteren bir değer alır.

public:
 property bool IsInertial { bool get(); };
public bool IsInertial { get; }
member this.IsInertial : bool
Public ReadOnly Property IsInertial As Boolean

Özellik Değeri

trueManipulationDelta olay eylemsizlik sırasında gerçekleşirse; false kullanıcı ile UIElementiletişim kurduğunda olay gerçekleşirse.

Örnekler

Aşağıdaki örnekte olay için bir olay işleyicisi gösterilmektedir ManipulationDelta . Örnek, olayın eylemsizlik sırasında oluşup oluşmadığını ManipulationDelta ve dikdörtgenin bir pencerenin kenarına dokunup dokunmadığını denetler. Bu durumlar doğruysa, uygulama dikdörtgenin uygulamanın görünür alanından ayrılmasını önlemek için işlemeyi durdurur. Bu örnek, İzlenecek Yol: İlk Dokunmatik Uygulamanızı Oluşturma başlığı altındaki daha büyük bir örneğin bir parçasıdır.

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

Açıklamalar

Olayın eylemsizlik sırasında mı yoksa kullanıcı olayı alan öğeyle iletişim kurduğunda mı ManipulationDelta gerçekleştiğini ManipulationDelta belirlemek için bu yöntemi kullanabilirsiniz.

Şunlara uygulanır