Haven't Been Able to get this to Work.

Mar 29, 2011 at 2:51 PM

I've tried the demo application and have yet to find a way to get this to work properly. It never tombstones regardless if I name the controls or put the proper OnNavigatedFrom/OnNavigatedTo method. Am I missing something? You can find me on twitter @mbcrump

Coordinator
Apr 28, 2011 at 2:15 PM

Did you work out why this wasn't working for you?

May 4, 2011 at 5:00 PM

I'm having the same issue.

I think my issue is because the listbox I am trying to save the state for is inside a Pivot control, so it is not being picked up by whatever algorithm is being used to find child framework elements.

Coordinator
May 4, 2011 at 9:51 PM

@samjudson I'm currently adding support for PivotControls. There's an issue walking the visual tree after activation where the contents of the pivotitems don't exist yet. Hopefully I'll get this sorted this week.

Coordinator
May 7, 2011 at 6:40 AM

@samjudson If you get the latest from source, this now supports the Pivot Control.

Official V2 coming shortly.

May 14, 2011 at 12:05 AM

Using the latest source code, restore fails if a page contains a pivot control that is not named.  Adding an "x:Name" works around the problem.

Yes, I should have named it if I wanted it saved (which I did), but the code shouldn't die (in case I didn't).

The failure is in the last line below in PhoneApplicationPageExtensions.cs: 

 

        public static void RestoreState(this PhoneApplicationPage page)
        {
            if (page.State.Keys.Count > 0)
            {
                if (page.State.ContainsKey(PAGE_CONTAINS_PIVOT))
                {
                    pivotToRestoreTo = page.ChildrenOfType<Pivot>().First();

Coordinator
Jun 1, 2011 at 7:09 PM

For reference. This was fixed in changeset 0280319ed9ce which was incoprorated in the v2.0 release.