Silverlight工具包动画无法正常工作

时间:2011-10-18 05:03:00

标签: windows-phone-7 silverlight-4.0 windows-phone-7.1

我在我的应用程序中添加了以下用于实现工具包动画的代码。但它完全适用于模拟器,但在设备中没有任何事情发生,我认为动画发生得非常快或没有任何事情发生。我还是无法纠正这个问题。请有人帮我解决这个问题。

 TurnstileTransition turnstileTransition = new TurnstileTransition();
 turnstileTransition.Mode = TurnstileTransitionMode.BackwardOut;
 PhoneApplicationPage phoneApplicationPage =
 (PhoneApplicationPage)(((PhoneApplicationFrame)   
 Application.Current.RootVisual)).Content;
 ITransition transition = turnstileTransition.GetTransition(phoneApplicationPage);
 transition.Completed += delegate { transition.Stop(); };
 transition.Begin();

2 个答案:

答案 0 :(得分:4)

你必须替换

RootFrame = new PhoneApplicationFrame();

RootFrame = new TransitionFrame();

它位于App.xaml.cs中的#region Phone application initialization

答案 1 :(得分:0)

您可以尝试使用示例herehere

的XAML替代方案

样品:

 <!-- Navigation Animations -->
<toolkit:TransitionService.NavigationInTransition>
    <toolkit:NavigationInTransition>
        <toolkit:NavigationInTransition.Backward>
            <toolkit:TurnstileTransition Mode="BackwardIn"/>
        </toolkit:NavigationInTransition.Backward>
        <toolkit:NavigationInTransition.Forward>
            <toolkit:TurnstileTransition Mode="ForwardIn"/>
        </toolkit:NavigationInTransition.Forward>
    </toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>

<toolkit:TransitionService.NavigationOutTransition>
    <toolkit:NavigationOutTransition>
        <toolkit:NavigationOutTransition.Backward>
            <toolkit:TurnstileTransition Mode="BackwardOut"/>
        </toolkit:NavigationOutTransition.Backward>
        <toolkit:NavigationOutTransition.Forward>
            <toolkit:TurnstileTransition Mode="ForwardOut"/>
        </toolkit:NavigationOutTransition.Forward>
    </toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
<!-- EO Navigation Animations-->