Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Phone 8 page lifecycle

I started developing an App for Windows Phone 8 and was wondering how my handling and keeping track of Page-Instances could affect performance and memory consumption.

What is the usual lifecycle of a Page-Object? Can i monitor the necessity of a Page-Object staying alive?

Thanks

like image 314
Gabriel Koch Avatar asked Mar 22 '23 13:03

Gabriel Koch


1 Answers

Not so sure if what you ask is the following:

Each Windows Phone Page has a constructor method which is called only once when the page is created - meaning that this method is called only once.

Then comes the OnNavigatedTo() and OnNavigatedFrom() methods. The first one is the next in line after the constructor when you are navigating from another page to the current one. The navigated from is being called while you are navigating away from the current page - when this page will be added to the page stack (a.k.a. journal).

Next follows the Loaded() method which is called after the OnNavigatedTo() method and also gets called every time you navigate to the current page.

Finally you have the OnBackKeyPress() and RemovedFromJournal() methods that gets called when you are trying to navigate away from the page and when the page is 'destroyed'. The first method that gets called here is OnBackKeyPress() and then the RemovedFromJournal().

like image 184
George Nikolaides Avatar answered Apr 29 '23 09:04

George Nikolaides