1.命名空間
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
2.在PhoneApplicationPage根節點下添加如下代碼
<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>
3.在InitializePhoneApplication方法裡把RootFrame初始化為TransitionFrame
RootFrame = new TransitionFrame();
除了翻頁動畫,toolkit還提供了滾動(roll),旋轉(rotate),滑動(slide),和迴旋(swivel)四種不同的動畫