locked
LoadState does not fire RRS feed

  • Question

  • Hi,

    I have a page that was created by the Basic Page template.

    The page is created with the LoadState and the SaveState functions. I added code to the page from one of the Microsoft Samples, that uses the OnNavigatedTo(). Before adding the OnNavigatedTo, the LoadState would fire. After adding the OnNavigatedTo LoadState would not fire, but OnNavigated does fire.

    I am a bit confused when to use the LoadState() and when to to use the OnNavigatedTo(), and why LoadSave() would not fire?

    Thanks,
    EitanB


    • Edited by eitanb Friday, August 31, 2012 2:56 AM
    Friday, August 31, 2012 2:53 AM

Answers

  • LoadState and SaveState functions are just implementations of the LayoutAwarePage.cs. LayoutAwarePage basically uses the OnNavigatedTo and OnNavigatedFrom functions to execute the aforementioned methods. In the SDK samples (in most of them), the pages do not derive from LayoutAwarePage so they use OnNavigated to function if they need some initialization.

    Here is a post from MS: What is LayoutAwarePage?


    Can Bilgin
    Blog CompuSight

    • Edited by Can Bilgin Friday, August 31, 2012 5:55 AM Added link
    • Marked as answer by eitanb Friday, August 31, 2012 6:28 AM
    Friday, August 31, 2012 5:52 AM
  • yeap you absolutely are right...

    Can Bilgin
    Blog CompuSight

    • Marked as answer by eitanb Friday, August 31, 2012 6:28 AM
    Friday, August 31, 2012 6:13 AM

All replies

  • LoadState and SaveState functions are just implementations of the LayoutAwarePage.cs. LayoutAwarePage basically uses the OnNavigatedTo and OnNavigatedFrom functions to execute the aforementioned methods. In the SDK samples (in most of them), the pages do not derive from LayoutAwarePage so they use OnNavigated to function if they need some initialization.

    Here is a post from MS: What is LayoutAwarePage?


    Can Bilgin
    Blog CompuSight

    • Edited by Can Bilgin Friday, August 31, 2012 5:55 AM Added link
    • Marked as answer by eitanb Friday, August 31, 2012 6:28 AM
    Friday, August 31, 2012 5:52 AM
  • So if I use the LayoutAwarePage it means I should use the LoadState and SaveState functions and not the. OnNavigatedTo and OnNavigatedFrom functions?

    Thanks,
    EitanB

    Friday, August 31, 2012 6:08 AM
  • yeap you absolutely are right...

    Can Bilgin
    Blog CompuSight

    • Marked as answer by eitanb Friday, August 31, 2012 6:28 AM
    Friday, August 31, 2012 6:13 AM
  • Thanks,
    EitanB

    Friday, August 31, 2012 6:28 AM