AnimationContext = LayoutRoot must be specified in OnNavigatedTo

Jul 16, 2012 at 11:01 PM

I've just noticed a very irritating behavior when using the WP7Contrib transitions:

If you use AnimatedBasePage as base on your pages and navigate to a second page in the app, then press either the Home button or the Bing button to "deactivate" the app, then immediately use the back-button to "reactivate" the application, you will no longer be able to use the back-button within the app.

This is true if you leave the AnimationContext set to null (either by not setting it at all) or if you set it to for example LayoutRoot in the constructor of the page. You must set AnimationContext = LayoutRoot within the OnNavigatedTo since it will be called when the page is reactivated and apparently it's not being rehydrated when the page gets reactivated by the framework properly.

Investigating the source code I noticed that the method CanAnimated on AnimatedBasePage returns false when being called on a reactivated page unless the AnimationContext is explicitly set in OnNavigatedTo.

Anyone else experiencing the same behavior?