简体   繁体   中英

ShareLinkTask instansiate a new page?

In my browser app, I noticed when ShareLinkTask is called, the app's MainPage() is called again. How do I make sure the app does not navigate to the new instance of the MainPage when returning from ShareLinkTask ?

The reason I want the original page is that the app has to remember the LayoutRoot grid on that page in order to display an UI animation. But since the new LayoutRoot grid is a different instance, the animation is not running once the app return from ShareLinkTask .

What am I missing?

ShareLinkTask is one of the Launchers. Your application will be Deactivated when you use a Launcher and go into Dormant or Tombstoned mode. In the first case the MainPage constructor would not be called again after returning from Launcher, only the OnNavigatedTo method. To prepare for the second case, save the state of the animation in OnNavigatedFrom and read the saved state in OnNavigatedTo. Read more about Tombstoning, starting with Activation and deactivation best practices and How to preserve and restore page state .

More about Launchers and Choosers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM