سؤال

I want to remove pages from backstack till a particular page say "C" has reached when I am on some other page say "F". Is Its posiible to remove backstack upon pagename?

Thanks and Regards, Kanaya

هل كانت مفيدة؟

المحلول

You can easily traverse the backstack and check the page names and remove items like this:

        while (NavigationService.CanGoBack)
        {
            if (NavigationService.BackStack.First().Source.OriginalString == "/C.xaml")
            {
                break;
            }
            NavigationService.RemoveBackEntry();
        }

نصائح أخرى

You can keep a record a all the pages you have navigated in the code like a screen manager. That contain the pages in the same order as the default stack. So you can find the position of the desired page from that list and call remove back entry function that many times.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top