0

I have a weird probleme : I navigate to a view, I check one or more CheckBox and navigate back (I didn't override the navigateFrom method). Then I navigate to my view again, and the checkbox aren't checked.

Is this even normal behavior ? I this part of the tombstonning "feature" of Windows Phone 7 ? If yes, does that mean that whenever I navigate from a view, even if its within my app, I need to save state ? (I yes, that sucks...)

MrSmith42
  • 9,961
  • 6
  • 38
  • 49
Thomas Joulin
  • 6,590
  • 9
  • 53
  • 88
  • Navigation within your own app does not use tombstoning, so your question title is a bit misleading. You're really asking about view states in your own app. – ctacke Nov 09 '10 at 15:09
  • well, if it's not tombstoning, what is it ? I navigate within my app, but it seems that my data are lost in the process – Thomas Joulin Nov 09 '10 at 15:42

1 Answers1

4

It sounds like what you're doing is:

  1. Navigate to a page
  2. Change something on the UI of that page(the checkbox)
  3. Go back from that page
  4. Return to that page again

If that's what you're doing, here's what's happening.

In point 3 the page is destroyed. If you didn't save something then the sytem won't have magically saved it for you.

In point 4 a brand new page is created. If you haven't written any code to set up the UI state then it will be the default.

Presumably the checked state of the checkbox is representative of something else in your app. You should therefore probably look at binding it's checked state to the underlying setting.

Because the system can't know what is a change you want persisting and what isn't, it leaves this up to you.

It's normally best to save data or setting changes as soon as they are made. Regardless of navigating within your application, your app could get tombstoned at any point and you'll probably want to preserve the app and it's data/state so that the user doesn't lose anything or get confused as a result of tombstoning.

Matt Lacey
  • 65,560
  • 11
  • 91
  • 143
  • this is exactly what I am doing. So I fixed it like this : do a binding used by my view with checkboxes and my view "parent". Now it works. But it was not an issue with tombstoning, right ? I still have to handle a persistant storage in case it gets tombstoned ? Thanks for you help ! – Thomas Joulin Nov 10 '10 at 09:26