locked
Windows Phone 8.1 apps - Opening another page RRS feed

  • Question

  • i have 2 pages. MainPage has a Textbox which is Collapsed by default. 

    1. MainPage

    2. LoginPage

    When i go to the  "MainPage.Xaml"  from the "Login.Xaml".  I change the value of the Textbox to Visible via a button click.

    Everything is fine. But, after going back to "LoginPage.Xaml" from the "MainPage.Xaml". 

    I tried to go back to the "MainPage.xaml" via this code

     this.Frame.Navigate(typeof(MainPage))

    When i land on the "Mainpage". Everything looks like the way  i left it. The visibility value of the textbox was Visible. But it should be Collapsed because that was the default value i set it to in my XAML design. My understanding was that, when you navigate to a page it creates a new instant of that page. Not bring back the old instant you were working with.

    Whats going on here? How can i fix it?

    Monday, June 9, 2014 2:07 AM

Answers

All replies

  • See Caching a  page and check your Page's NavigationCacheMode property

    You can also initialize items in OnNavigatedTo if you want to set them separately.

    --Rob

    • Marked as answer by kalel111 Monday, June 9, 2014 5:06 AM
    Monday, June 9, 2014 4:38 AM
  • Thnx bob. 

    i had to use this code

    this.NavigationCacheMode = 
            Windows.UI.Xaml.Navigation.NavigationCacheMode.Disabled;
    looks like the value was set to Enabled by default. Somehow.

    Monday, June 9, 2014 5:06 AM