I am working on a Windows Phone 8.1 app as part of a Windows Universal App. Following the tutorial on extending splash screens in Windows Universal Apps I changed my App.xaml.cs to replace
if (!rootFrame.Navigate(typeof(SplashPage), e.Arguments))
{
throw new Exception("Failed to create splash page");
}
with
if (e.PreviousExecutionState != ApplicationExecutionState.Running)
{
var extendedSplash = new SplashPage(e.SplashScreen);
Window.Current.Content = extendedSplash;
}
However this meant that I lost access to the root frame when I overwrote Window.Current.Content
. I would like to instead use
SplashPage.SplashScreen = e.SplashScreen;
if (!rootFrame.Navigate(typeof(SplashPage), e.Arguments))
{
throw new Exception("Failed to create splash page");
}
But now the page transitions in. There is an override for Frame.Navigate
which takes an additional NavigationTransitionInfo
parameter, typically set to one of its subclasses:
(N.B. James Croft has a good blog post showing these transitions.)
But for a splash screen extension I need the page to show immediately, without a transition (just as one gets by overwriting Window.Current.Content
with the new page instance).
How do I set Frame.Navigate
to happen immediately with no transition?
I would try to disable default Frame.ContentTransitions by setting it to null, just after the rootFrame is created in App.xaml.cs file (don't forget to handle different events - Launched/ShareTarget/Activated - if needed):
rootFrame.ContentTransitions = null
once you have done that, pages shouldn't have transition. Then if you want, you can bring back or set new transitions for Frame's content upon specific circumstances, or set transitions for pages individually, for example in Page's XAML:
<Page.Transitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Page.Transitions>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With