locked
How to enable NavigationCacheMode for specific navigation only.

    Question

  • Hello,

    Scenario is that I have a three page PageA , PageB and PageC , if user goes from PageB->C and comes back to B than I need navigationcache at that time, but if users navigates from PageB->A and comes back to B I don't want navigationcache.

    It is somewhat complex scenario but I hope you got what I need to accomplish.

    Thanks in advance.

    Thursday, June 19, 2014 6:22 AM

Answers

  • I'm not sure your code there does what you described previously, but another more straightforward option would be to leave the cache on but reset the data if navigating from PageA.

    Friday, June 20, 2014 10:14 PM
    Owner

All replies

  • NavigationCache isn't conditional. It's either on or off for the page.

    That said, you could try disabling it when you navigate from PageB to PageA and then reenable it when you navigate back to PageB.

    --Rob

    Thursday, June 19, 2014 10:02 PM
    Owner
  • Hi Rob,

    Thanks for the reply,

    I tried the following code in OnNavigatedFrom method of PageB but still not working. Cache remains disable.

     if (e.SourcePageType.Name == "PageA")
      this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Disabled;
    else
      this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;

    Friday, June 20, 2014 5:42 AM
  • I'm not sure your code there does what you described previously, but another more straightforward option would be to leave the cache on but reset the data if navigating from PageA.

    Friday, June 20, 2014 10:14 PM
    Owner