1.首先引用Microsoft.Phone.Toolkit
2.将App.xaml.cs 中的 RootFrame = new PhoneApplicationFrame(); 改成RootFrame = new TransitionFrame();
3.引用toolkit
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
4.toolkit中一共有5中动画效果
☻SlideTransition 飞入动画
☻RotateTransition 旋转动画
☻SwivelTransition 垂直翻转动画
☻TurnstilTransition 翻页动画动画
☻RollTransition 360度旋转动画
5.添加动画效果,以其中的一种动画效果为例
<toolkit:TransitionService.NavigationInTransition> <toolkit:NavigationInTransition> <toolkit:NavigationInTransition.Backward> <toolkit:SlideTransition Mode="SlideLeftFadeIn" /> </toolkit:NavigationInTransition.Backward> <toolkit:NavigationInTransition.Forward> <toolkit:SlideTransition Mode="SlideRightFadeIn" /> </toolkit:NavigationInTransition.Forward> </toolkit:NavigationInTransition> </toolkit:TransitionService.NavigationInTransition> <toolkit:TransitionService.NavigationOutTransition> <toolkit:NavigationOutTransition> <toolkit:NavigationOutTransition.Backward> <toolkit:SlideTransition Mode="SlideLeftFadeOut"/> </toolkit:NavigationOutTransition.Backward> <toolkit:NavigationOutTransition.Forward> <toolkit:SlideTransition Mode="SlideRightFadeOut"/> </toolkit:NavigationOutTransition.Forward> </toolkit:NavigationOutTransition> </toolkit:TransitionService.NavigationOutTransition>
如果想更改其他切换效果,只需将蓝色字体的内容换成对应的效果,再把Mode方式更改对应的方式即可。
来源:https://www.cnblogs.com/lihaibo-Leao/p/3140760.html