I am using the KeepAlive
property on a page so that I am able to navigate back to it in the state that the user left it in.
The user is able to search for a Company, look at further details on the Company in an additional page, and then navigate back to the search page in the search state they left it in.
I also take advantage of the Loaded
event on a page to set it up in a way that a users favourite Companies are displayed first.
After searching, when the user navigates back from the details page inevitably the Loaded event is fired and their search is reset, back to the state depicted in the Loaded method.
My question is this - is there a way I can fire the Loaded event when the page is loaded for the first time, however when it is KeptAlive
and navigated back to, the Loaded event is not fired?
I would also prefer a way to unattach this behaviour because if a user truly does navigate away from the search page (i.e NOT to the details page) I would want the page to fire the Loaded event the next time said user navigates to it.
EDIT:
var estimatingContractsPage = new EstimatingContractsPage(selectedItem);
NavigationService?.Navigate(estimatingContractsPage);