ManipulationStartingRoutedEventArgs Class

Stellt Daten für das ManipulationStarting-Ereignis bereit.

Vererbung

Object
  RoutedEventArgs
    ManipulationStartingRoutedEventArgs

Syntax


public sealed class ManipulationStartingRoutedEventArgs : RoutedEventArgs

Attribute

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Member

ManipulationStartingRoutedEventArgsKlasse hat diese Membertypen:

Konstruktoren

ManipulationStartingRoutedEventArgsKlasse hat diese Konstruktoren.

KonstruktorBeschreibung
ManipulationStartingRoutedEventArgs Initializes a new instance of the ManipulationStartingRoutedEventArgs class.

 

Methoden

The ManipulationStartingRoutedEventArgs Klasse erbt Methoden von Object Klasse.

Eigenschaften

Der ManipulationStartingRoutedEventArgsKlasse hat diese Eigenschaften.

EigenschaftZugriffstypBeschreibung

Container

Lese-/SchreibzugriffGets the UIElement that is considered the container of the manipulation.

Handled

Lese-/SchreibzugriffGets or sets a value that marks the routed event as handled. Setting to true prevents most handlers along the event route from handling the same event again.

Mode

Lese-/SchreibzugriffGets or sets which types of manipulations are possible.

OriginalSource

SchreibgeschütztGets a reference to the object that raised the event. (Geerbt von RoutedEventArgs)

Pivot

Lese-/SchreibzugriffGets or sets an object that describes the pivot for a single-point manipulation.

 

Beispiele

Im folgenden Codebeispiel wird Szenario 4 aus dem Eingabebeispiel gezeigt. Dieser Code veranschaulicht einige Verwendungsmuster für die direkte Bearbeitung mithilfe der ManipulationStarting-, ManipulationStarted-, ManipulationDelta-, ManipulationInertiaStarting und ManipulationCompleted-Ereignisse.


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();
}


Anforderungen

Mindestens unterstützter Client

Windows 8 [Nur Windows Store-Apps]

Mindestens unterstützter Server

Windows Server 2012 [Nur Windows Store-Apps]

Namespace

Windows.UI.Xaml.Input
Windows::UI::Xaml::Input [C++]

Metadaten

Windows.winmd

Siehe auch

RoutedEventArgs

 

 

Anzeigen:
© 2014 Microsoft