Xamarin.Forms Shell Lifecycle

Download Sample Download the sample

Shell applications respect the Xamarin.Forms lifecycle, and an Appearing event is raised when a page is about to appear on the screen, and a Disappearing event is raised when a page is about to disappear from the screen. These events are propagated to pages, and can be handled by overriding the OnAppearing or OnDisappearing methods on the page.

Note

In a Shell application, the Appearing and Disappearing events are raised from cross-platform code, prior to platform code making a page visible, or removing a page from the screen.

For more information about the Xamarin.Forms app lifecycle, see Xamarin.Forms App Lifecycle.

Hierarchical navigation

In a Shell application, pushing a page onto the navigation stack will result in the currently visible ShellContent object, and its page content, raising the Disappearing event. Similarly, popping the last page from the navigation stack will result in the newly visible ShellContent object, and its page content, raising the Appearing event.

For more information about hierarchical navigation, see Xamarin.Forms Hierarchical Navigation.

In a Shell application, pushing a modal page onto the modal navigation stack will result in all visible Shell objects raising the Disappearing event. Similarly, popping the last modal page from the modal navigation stack will result in all visible Shell objects raising the Appearing event.

For more information about modal navigation, see Xamarin.Forms Modal Pages.