Navigate forward then remove pages from stack?

Nov 26, 2014 at 8:01 PM
Edited Nov 26, 2014 at 8:59 PM
Instead of finding a page in the stack and using GoBackToAsync, is it possible to go forward to a page but then remove items from the stack.

So if I have page A B C D and I navigate all the way to D, then navigate to B, then remove 2 items from the stack.

edit: maybe add something like:
 /// <summary>
        /// Remove a page from the stack at the specified index.
        /// </summary>
        /// <param name="index"></param>
        public void RemovePageAt(int index)
        {
            _pages.RemoveAt(index);
            _currentIndex--;
        }
Coordinator
Nov 29, 2014 at 10:22 AM
Good point. I think we need a way to remove a page from the stack.
I've added:
        public bool RemovePageFromStack(MtPageDescription pageDescription)
and
        public bool RemovePageFromStackAt(int pageIndex)
Please clone or download the source code from this page and test it in your project. If everything works ill create a new nuget package version...
Coordinator
Dec 7, 2014 at 6:43 PM
Is it working for you? The newest nuget package version contains these two methods..
Dec 8, 2014 at 9:06 PM
Thanks, I'll check this out. When I made the changes it worked but the animation was messed up.
Coordinator
Dec 11, 2014 at 3:57 PM
Can you provide a simple working sample to reproduce the issue?
Dec 11, 2014 at 7:49 PM
I will if I can reproduce it. Your solution may not have the same result.
Coordinator
Dec 11, 2014 at 8:03 PM
What animations are you using? As you can read on the MtPage page, the NavigationThemeTransition is not support..

Read this page at the end:
http://mytoolkit.codeplex.com/wikipage?title=MtPage&referringTitle=Documentation
Dec 11, 2014 at 10:42 PM
Edited Dec 11, 2014 at 10:42 PM
Just the default. I'll test it tonight.

With my changes the case was:
  1. Nav to Page A->B->C->D
  2. User does stuff on page D and when done, navigate to page B, removing C and D from the stack.
  3. Hit the back button, this takes user to Page A but the default animation that you normally see is cut short.
  4. Navigate to Page B, and then back to A, the animation is normal.
Coordinator
Dec 12, 2014 at 7:11 AM
Can you post some XAMl or code of your animations?
Dec 12, 2014 at 2:49 PM
I tested your changes and it works fine. I think when I made changes I allowed the new current page to be removed and that was screwing it up.

I'm able to nav to A->B->C->D,
then nav to B so I have A->B->C->D->B
then remove B,C,D and am left with A->B
and if I hit back it looks correct.
Coordinator
Dec 12, 2014 at 2:53 PM
Ok, so its fixed now? Of course its is not allowed to remove the current page - tho should throw an exception....

I'll releases new NuGet version this weekend...
Dec 12, 2014 at 3:00 PM
Edited Dec 12, 2014 at 3:01 PM
Yes, its fixed. The exception also works if you try and remove the current page. Thanks!
Coordinator
Dec 15, 2014 at 10:27 PM
Edited Dec 15, 2014 at 10:28 PM
Ok, thanks for helping to improve the lib. Ill soon release a new nuget version. If you like the project, please follow and/or review it.