简体   繁体   中英

WP7 - Back Button without Navigation Service

Is it possible to some how capture the Back Button Event without using the Navigation Service?

A previous post here on StackOverflow describes the the Back Button Events (both the overload of OnBackKeyPress and the event handler PhoneApplicationPage_BackKeyPress ) only seem to fire when the navigation service is used.

My implementation is:

//Prepare the page;
NextPage page = new NextPage();

//When we are ready to transition
page.someData = data;
page.parent = this;
this.Content = page;

I'm using this so that I can store the page for use later (essentially so that I can cache it, especially since some of my pages download information from the internet, and so that I can pass it data like above. However, I still need to use the back button to return to the home page.

Is there anyway to trigger the back button while using the above method?

Storing a whole page to cache the data is a bad idea especially in a limited environment like .Net CF.

  • it complicates the app (complicated navigation logic, possible cycles)
  • app is limited to 90MB of memory

Store the data in IsolatedStorageSettings.ApplicationSettings when dealing with relatively small amount of data eg couple of strings, xml file < 1KB. Otherwise store the data in a file in Isolated Storage eg music, pictures, huge xmls etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM