Share via


ManipulationInertiaStartingRoutedEventArgs Classe

Définition

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

public ref class ManipulationInertiaStartingRoutedEventArgs 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 ManipulationInertiaStartingRoutedEventArgs 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 ManipulationInertiaStartingRoutedEventArgs : RoutedEventArgs
Public NotInheritable Class ManipulationInertiaStartingRoutedEventArgs
Inherits RoutedEventArgs
Héritage
Object Platform::Object IInspectable RoutedEventArgs ManipulationInertiaStartingRoutedEventArgs
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

ManipulationInertiaStartingRoutedEventArgs()

Initialise une nouvelle instance de la classe ManipulationInertiaStartingRoutedEventArgs.

Propriétés

Container

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

Cumulative

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

Delta

Obtient les modifications les plus récentes de la manipulation actuelle, en tant que ManipulationDelta.

ExpansionBehavior

Obtient ou définit le taux de ralentissement du mouvement d'expansion de l'inertie.

Handled

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

OriginalSource

Obtient une référence à l’objet qui a déclenché l’événement. Il s’agit souvent d’une partie de modèle 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.

RotationBehavior

Obtient des informations sur les informations de rotation associées à la manipulation pour cette occurrence d’événement.

TranslationBehavior

Obtient des informations sur les informations de traduction associées à la manipulation pour cette occurrence d’événement.

Velocities

Obtient les taux des modifications les plus récentes pour la manipulation.

S’applique à

Voir aussi

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