Update (December 3, 2014)
I just discovered a way to use animations to βhideβ an OS level turnstile when the application loads for the first time.
This requires three things -
- There is no popup image in the application.
ContentTransitions set to null on the NavigatedTo main page.- Create a
PageIn animation and animate the main page LayoutRoot with the background color - basically, to first align it with the background color of the system, and then animate it to whatever color you want in a short amount of time.
You can download the sample from here .
If you have all the code commented out. Do you think ContentTransitions should be null right? At least that's what I thought.
The answer is no . ContentTransitions will ContentTransitions be assigned to NavigationThemeTransition .
This may be because the Frame style has these lines of code by default.
<Setter Property="ContentTransitions"> <Setter.Value> <TransitionCollection> <NavigationThemeTransition/> </TransitionCollection> </Setter.Value> </Setter>
However, this Frame property is set very late. If you put a breakpoint in the constructor of your MainPage . You will see it still null . But if you put another breakpoint in OnNavigatedTo , you will see both this.Frame and this.Frame.ContentTransitions with values ββin them.
What if I uncomment
rootFrame.ContentTransitions = null;
I believe that there is no if (_contentTransitions != null) return; in the customizer of this property if (_contentTransitions != null) return; check, when you set it to null , there must be something that prevents it from getting the default value of NavigationThemeTransition , and why you are not doing this, Don't watch the turnstile animation anymore.
However, there is another animation , you will always see, no matter what you do.
Try pausing your application by pressing the back key or home and reactivate it. Yes, the turnstile animation is back! Although I think this turnstile animation is different from the ones we disabled in Frame.ContentTransitions . Take a look at how the application launches for the first time - a splash screen with turnstile animation. I guess this is the same thing, and it is probably controlled by the OS.
So why do they put in this check?
if (rootFrame.ContentTransitions != null)
My guess is that since there is an animation of OS level turnstiles, if you do not provide a screen saver, the OS will simply animate the launch of your application, so it makes sense to skip everything that is inside Frame.ContentTransitions .
You might ask, but Frame.ContentTransitions always null !
Here is one script that will not be null . Try creating your own Frame style with some default ContentTransitions , and instead
rootFrame = new Frame();
do
rootFrame = new Frame { Style = (Style)App.Current.Resources["MyFrame"] };
This time you will see that the code goes into the if , because ContentTransitions no longer null .