locked
How can i get back to original state the xaml page when the cache is enable? RRS feed

  • Question

  • this.frame.navigate(typeof(MainPage));

    i try this to navigate again to the MainPage but the cache is enable so it wont back to its original state. how can i do it even if i enable the cache

    code for enable the cache:

    this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;


    Saturday, January 18, 2014 1:06 PM

Answers

  • Remove this code :

    this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;

    and when you go back , the page will be the original state.

    or you can save your Controls states,and when page go back to do Reset,like this

    private string Text_Name_Original="abc";
    public MainPage()
    {
        this.InitializeComponent();
    }
    
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);
        Reset();
    }
    
    private void Reset() {
        Text_Name.Text = Text_Name_Original;
    }

    Sunday, January 19, 2014 9:53 AM

All replies

  • Remove this code :

    this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;

    and when you go back , the page will be the original state.

    or you can save your Controls states,and when page go back to do Reset,like this

    private string Text_Name_Original="abc";
    public MainPage()
    {
        this.InitializeComponent();
    }
    
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);
        Reset();
    }
    
    private void Reset() {
        Text_Name.Text = Text_Name_Original;
    }

    Sunday, January 19, 2014 9:53 AM
  • this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled; 
    i enable this because when i go to another xaml page(not mainpage) the cache must enable and when i go to mainpage i need to disable it
    Wednesday, January 29, 2014 8:34 AM