Share via


ManipulationCompletedRoutedEventArgs Classe

Définition

Fournit des données pour l’événement ManipulationCompleted.

public ref class ManipulationCompletedRoutedEventArgs sealed : RoutedEventArgs
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ManipulationCompletedRoutedEventArgs final : RoutedEventArgs
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ManipulationCompletedRoutedEventArgs : RoutedEventArgs
Public NotInheritable Class ManipulationCompletedRoutedEventArgs
Inherits RoutedEventArgs
Héritage
Object Platform::Object IInspectable RoutedEventArgs ManipulationCompletedRoutedEventArgs
Attributs

Exemples

L’exemple de code suivant illustre le scénario 4 de l’exemple Input. Ce code montre certains modèles d’utilisation pour la manipulation directe à l’aide des événements ManipulationStarting, ManipulationStarted, ManipulationDelta, ManipulationInertiaStarting et ManipulationCompleted .

private TransformGroup _transformGroup;
private MatrixTransform _previousTransform;
private CompositeTransform _compositeTransform;
private bool forceManipulationsToEnd;

public Scenario4()
{
    this.InitializeComponent();
    forceManipulationsToEnd = false;
    ManipulateMe.ManipulationStarting += 
        new ManipulationStartingEventHandler(
            ManipulateMe_ManipulationStarting);
    ManipulateMe.ManipulationStarted += 
        new ManipulationStartedEventHandler(
            ManipulateMe_ManipulationStarted);
    ManipulateMe.ManipulationDelta += 
        new ManipulationDeltaEventHandler(
            ManipulateMe_ManipulationDelta);
    ManipulateMe.ManipulationCompleted += 
        new ManipulationCompletedEventHandler(
            ManipulateMe_ManipulationCompleted);
    ManipulateMe.ManipulationInertiaStarting += 
        new ManipulationInertiaStartingEventHandler(
            ManipulateMe_ManipulationInertiaStarting);
    InitManipulationTransforms();
}

private void InitManipulationTransforms()
{
    _transformGroup = new TransformGroup();
    _compositeTransform = new CompositeTransform();
    _previousTransform = new MatrixTransform() { 
        Matrix = Matrix.Identity };

    _transformGroup.Children.Add(_previousTransform);
    _transformGroup.Children.Add(_compositeTransform);

    ManipulateMe.RenderTransform = _transformGroup;
}

private void ManipulateMe_ManipulationStarting(object sender, 
    ManipulationStartingRoutedEventArgs e)
{
    forceManipulationsToEnd = false;
    e.Handled = true;
}

private void ManipulateMe_ManipulationStarted(
    object sender, ManipulationStartedRoutedEventArgs e)
{
    e.Handled = true;
}

private void ManipulateMe_ManipulationInertiaStarting(
    object sender, ManipulationInertiaStartingRoutedEventArgs e)
{
    e.Handled = true;
}

private void ManipulateMe_ManipulationDelta(
    object sender, ManipulationDeltaRoutedEventArgs e)
{
    if (forceManipulationsToEnd)
    {
        e.Complete();
        return;
    }

    _previousTransform.Matrix = _transformGroup.Value;

    Point center = _previousTransform.TransformPoint(
        new Point(e.Position.X, e.Position.Y));
    _compositeTransform.CenterX = center.X;
    _compositeTransform.CenterY = center.Y;

    _compositeTransform.Rotation = (e.Delta.Rotation * 180) / Math.PI;
    _compositeTransform.ScaleX = 
        _compositeTransform.ScaleY = e.Delta.Scale;
    _compositeTransform.TranslateX = e.Delta.Translation.X;
    _compositeTransform.TranslateY = e.Delta.Translation.Y;

    e.Handled = true;
}

private void ManipulateMe_ManipulationCompleted(object sender, 
    ManipulationCompletedRoutedEventArgs e)
{
    e.Handled = true;
}

private void Scenario4Reset(object sender, RoutedEventArgs e)
{
    Scenario4Reset();
}

void Scenario4Reset()
{
    forceManipulationsToEnd = true;
    ManipulateMe.RenderTransform = null;
    InitManipulationTransforms();
}

Constructeurs

ManipulationCompletedRoutedEventArgs()

Initialise une nouvelle instance de la classe ManipulationCompletedRoutedEventArgs.

Propriétés

Container

Obtient l’élément UIElement qui est considéré comme le conteneur de la manipulation.

Cumulative

Obtient les modifications globales depuis le début de la manipulation.

Handled

Obtient ou définit une valeur qui marque l’événement routé comme géré. La définition de pour true empêche la plupart des gestionnaires le long de l’itinéraire des événements de gérer à nouveau le même événement.

IsInertial

Obtient si l’événement ManipulationCompleted se produit pendant l’inertie.

OriginalSource

Obtient une référence à l’objet qui a déclenché l’événement. Il s’agit souvent d’un modèle faisant partie d’un contrôle plutôt que d’un élément qui a été déclaré dans l’interface utilisateur de votre application.

(Hérité de RoutedEventArgs)
PointerDeviceType

Obtient le PointerDeviceType pour l’appareil de pointeur impliqué dans la manipulation.

Position

Obtient les coordonnées d’écran x et y de l’entrée tactile à la position terminée.

Velocities

Obtient les rapidités utilisées pour la manipulation.

S’applique à

Voir aussi

  • <xref:Microsoft.UI.Xaml.RoutedEventArgs%0andows.ui.xaml%2froutedeventargs.md)>