Reputation: 2679
I can't find any event that could be fired when page shown after back button is pressed on another page. OnAppearing isn't fired. Page constructor also. In UWP there exist OnNavigated event..
Upvotes: 2
Views: 8213
Reputation: 2981
Each Page
has an override for OnBackButtonPressed
.
protected override bool OnBackButtonPressed()
{
return base.OnBackButtonPressed();
}
If you want to perform an action on the page you should look at the OnAppearing
and OnDisappearing
overrides on the page. If that doesn't suit your needs you could you could look into using the MessagingCenter to trigger an event on the appropriate method and subscribing to it in the screen you're navigating to.
As far as I know there are no other events that can handle this situation. What platform are you on? OnAppearing
should be called but Android has some different behavior where it isn't called e.g. in some pop modal situations. To diagnose further you should provide some sample code on how you're pushing/popping pages etc.
Upvotes: 2