我正在编写一个通用应用程序,需要正确地处理Manipualtiondelta的操纵惯性。当操作时,我获得正常值,但是惯性部分始终为零(旋转和翻译)。它仅在Windows Phone中发生这种情况,如Windows 8.1。 为防止问题,我确实设置了ManipulationModes.all.

有帮助吗?

解决方案

我测试了它。惯性肯定存在于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>
.

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;
}
.

不确定问题。希望我的代码有所帮助。

祝你好运!

其他提示

不要使用delta.translation下惯性。它是计算值,取决于自上述事件以来通过的时间量。所以第一是(0,0)。

而是这样做的东西

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

速度在LPX / MSEC中(逻辑像素每毫米) 将其乘以〜400以获得惯性将带给您的估计。

Windows Phone平台上不支持以下项目:

  • 不支持iSmanipulateNabled属性。在Windows Phone上默认情况下启用操作事件。
  • 不支持旋转变换。
  • 不支持
  • <强>惯性事件。

http://technet.microsoft.com/en-US / Windows / FF426933(v= vs.96)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top