Hi I just found out that my application was crashing when returning from tombstoning. I was able to target the problem here inside the constructor of my page:
RadPhoneApplicationFrame frame = App.Current.RootVisual as RadPhoneApplicationFrame;
frame.PageTransitionCompleted +=
new EventHandler<EventArgs>(frame_PageTransitionCompleted);
Everytime the app is Re-Activated the RootVisual is setting the frame to null. I'm wondering if there is a casting issue here because before I used this code my tombstoning was working perfectly and I was able to navigate freely throughout the app. Any ideas on what might be causing this? Or maybe a work around?
You should move this code from page constructor to
OnNavigatedTo
method override in your page. Reason is thatRootVisual
is probably set inRootFrame.Navigated
event handler which is generated after page is constructed, not before (this depends of implementation in yourApp.xaml.cs
).Of course because
OnNavigatedTo
method may be runned more that once for a page, you should make sure thatPageTransitionCompleted
event handler is not assigned two times (just use-=
before+=
).Another option is to move this code to
App.xaml.cs
. This makes sense most to me, because thatPageTransitionCompleted
event is related to whole app, not a single page.