主要通过StoryBoard来控制PlaneProjection的RotationY来实现
XAML:
<Grid x:Name="LayoutRoot" Background="White" Height="Auto" Width="Auto">
<Grid.Resources>
</Grid.Resources>
<StackPanel>
<UCTL:NavgationforZB x:Name="Navgation"></UCTL:NavgationforZB>
<Grid x:Name="ChartPanel" Height="Auto" Width="Auto" >
</Grid>
</StackPanel>
</Grid >
CS:
private void Flip()
{
PlaneProjection pp = new PlaneProjection { CenterOfRotationY = .5, CenterOfRotationX=.5 };
this.ChartPanel.Projection = pp;
if (perSb != null)
{
perSb.Stop();
}
Storyboard sboard = new Storyboard();
perSb = sboard;
DoubleAnimation daAngle = new DoubleAnimation();
daAngle.From = -180;
daAngle.To = 0;
daAngle.Duration = TimeSpan.FromSeconds(1);
daAngle.EasingFunction = new PowerEase() { EasingMode = EasingMode.EaseOut, Power = 3 };
Storyboard.SetTargetProperty(daAngle, new PropertyPath("RotationY"));
Storyboard.SetTarget(daAngle, pp);
sboard.Children.Add(daAngle);
sboard.Begin();
}
有几点注意的地方:
1. Storyboard.SetTarget(daAngle, pp); target 是PlaneProjection 的对象;
2. 执行Storyboard的Begin方法的时停止前一个Storyboard;
3.如果From 0 to 180来翻转的话文字是横向180反转的,0 to 360 这样的话就会转两圈,文字是正了,但是有个超级郁闷的问题,文字模糊了。害我浪费了一天。
后来突发奇想改成 -180 to 0 居然OK了。汗==!!!!