UWP Page Transition Animations

二次信任 提交于 2019-12-22 04:25:09

问题


I programing in Windows 10 UWP. I have a Frame in Xaml that I would like to have the Page/Content to slide left and off screen when the use navigates away from the page to another page. Any Idea how to do Frame Navigation Animations?


回答1:


Try to use build-in animation:

protected virtual void SetUpPageAnimation()
{
    TransitionCollection collection = new TransitionCollection();
    NavigationThemeTransition theme = new NavigationThemeTransition();

    var info = new ContinuumNavigationTransitionInfo();

    theme.DefaultNavigationTransitionInfo = info;
    collection.Add(theme);
    this.Transitions = collection;
}

Call this method in Page's constructor and you will find that there will be animation when you enter or leave a Page.

There are few build-in animations which names end with Info, you should try them by yourself.




回答2:


There's a built-in way to do this, but that only supports a set of not customizable animations / page transitions.

If you want to do custom animations you'll need to implement your own Frame + Page subclasses, where your Pages contain their own entrance/leaving animations and your Frame calls these when navigating.



来源:https://stackoverflow.com/questions/32579445/uwp-page-transition-animations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!