MiddleTommy
MiddleTommy

Reputation: 389

UWP Page Transition Animations

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?

Upvotes: 8

Views: 8404

Answers (2)

JuniperPhoton
JuniperPhoton

Reputation: 746

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.

Upvotes: 18

Tamás Deme
Tamás Deme

Reputation: 2228

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.

Upvotes: 1

Related Questions