Windows phone 8 操纵增量报告大(错误)值,导致无限旋转

Windows phone 8 操纵增量报告大(错误)值,导致无限旋转,windows-phone-8,windows-phone,Windows Phone 8,Windows Phone,我试图使用事件ManiuplationDelta的e.cumulativeManiUpulation.Translation.X围绕Y轴旋转一些stackPanel, 当stackPanel.Projection.rotationY接近90度时,旋转变得异常。调试后,我发现e.CumulativeManipulation.Translation.X的值有时是-2000或3000等 为什么它报告了如此大的错误数字。有什么帮助吗 检查下面的代码片段 Xaml 编辑: 我发现了问题,我没有将Cente

我试图使用事件ManiuplationDelta的e.cumulativeManiUpulation.Translation.X围绕Y轴旋转一些stackPanel, 当stackPanel.Projection.rotationY接近90度时,旋转变得异常。调试后,我发现e.CumulativeManipulation.Translation.X的值有时是-2000或3000等

为什么它报告了如此大的错误数字。有什么帮助吗

检查下面的代码片段

Xaml

编辑: 我发现了问题,我没有将CenterOfRotationZ设置为0.5

<Grid x:Name="ContentPanel" Background="Yellow" Grid.Row="1" Margin="12,0,12,0" >
<StackPanel x:Name="Under" Background="DarkCyan" ManipulationDelta="ContentPanel_ManipulationDelta" >
            <TextBlock Text="Under" Foreground="Blue" FontSize="48"/>
            <StackPanel.Projection>
                <PlaneProjection CenterOfRotationX="0.5" CenterOfRotationY="0.5" RotationY="0"/>
            </StackPanel.Projection>

    </Grid>
  private void ContentPanel_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
    {
        ;
        double FullWidth = (sender as FrameworkElement).ActualWidth;
        delta = e.CumulativeManipulation.Translation.X;
        if (Math.Abs(delta) > FullWidth)
        {
            //Something wrong
            Debug.WriteLine("Cumulative x: " + e.CumulativeManipulation.Translation.X);
            Debug.WriteLine("width: " + (sender as FrameworkElement).ActualWidth);
            Debug.WriteLine("");
        }
        double RotateValue = (delta / FullWidth) * -180;
        var Underprojection = (Under.Projection as PlaneProjection);
        Underprojection.RotationY = RotateValue;
    }