Question

I'm writing a universal app and need to process manipulation inertia in ManipualtionDelta properly. I get normal values when manipulation, BUT the inertial part then is always zero (both rotation and translation). It seams that this happens only in Windows Phone, as in Windows 8.1 it seams fine. To prevent questions, I do set ManipulationModes.All.

Was it helpful?

Solution

I tested it. Inertia is certainly present in Windows Phone 8.1

<Grid>
    <Ellipse Width="100"
             Height="100"
             HorizontalAlignment="Center"
             VerticalAlignment="Center"
             Fill="White"
             ManipulationDelta="Ellipse_ManipulationDelta"
             ManipulationMode="All">
        <Ellipse.RenderTransform>
            <CompositeTransform />
        </Ellipse.RenderTransform>
    </Ellipse>
</Grid>

With this:

private void Ellipse_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
    var trasnform = (sender as FrameworkElement).RenderTransform as CompositeTransform;
    trasnform.TranslateX += e.Delta.Translation.X;
    trasnform.TranslateY += e.Delta.Translation.Y;
}

Not sure the issue. Hope my code helps.

Best of luck!

OTHER TIPS

Don't use Delta.Translation under inertia. It is a computed value, dependent on the amount of time passed since the previous event was run. So often the first is (0,0).

Instead do something like this

if (e.IsInertial) {
    ComputeMyOwnInertia(e.Velocities)
    e.Complete(); // no more inertial events
}

Velocities is in lpx/msec (logical pixels per milisecond) Multiply it by ~400 to get an estimation where inertia would bring you.

The following items are not supported on the Windows Phone platform:

  • The IsManipulationEnabled property is not supported. Manipulation events are enabled by default on Windows Phone.
  • Rotate transforms are not supported.
  • Inertia events are not supported.

http://technet.microsoft.com/en-us/windows/ff426933(v=vs.96)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top