I have just finished tombstoning a page in my application when I noticed that I only tombstone the page I am currently viewing, meaning that after I return the pages in the backstack lose all their members and doesn't get tombstoned.. I only find examples on how to tomstone the current page but nothing about tombstoning the backstack pages... What is the elegant way to do this?
Just to show How I'm tombstoning:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.IsNavigationInitiator == false)
{
_tombstone = this.LoadState<Tombstone>("tombstone");
}
else
{
_tombstone.NavigationParameters = NavigationParameters;
}
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (_tombstone != null && e.IsNavigationInitiator == false)
this.SaveState("tombstone", _tombstone);
}
public static void SaveState(this PhoneApplicationPage phoneApplicationPage, string key, object value)
{
if (phoneApplicationPage.State.ContainsKey(key))
{
phoneApplicationPage.State.Remove(key);
}
phoneApplicationPage.State.Add(key, value);
}
_tombstone contains all the vital members of my current page which I need to reinitialize the page after tombstoneing