What Order Do Navigation Methods Get Called in Windows Phone?


Recently, I was asked which gets called first: the Application_Launching, Application_Activated, Application_Deactivated, and Application_Closing events or the page-specific OnNavigatedTo and OnNavigatedFrom overrides. It turns out, the answer is – both.

When the application first runs from the start screen, Application_Launching gets called first. Then, the page-specific OnNavigatedTo gets called.

When navigating back to the start screen (by pressing the start button), the page-specific OnNavigatedFrom override gets called and then the Application_Deactivated event gets fired.

When navigating back to the app (using the back button), the Application_Activated fires first, and then the page’s OnNavigatedTo override gets hit.

So, the rule of thumb seems to be, if you are on a page, that page’s overrides will be called first. If you are entering the app from elsewhere, the Application events will fire first. Now you (and I) know!