# Mobile navigation and back

Let people move from a home screen into a detail and return without losing their place. Xui's mobile `NavigationView` maintains a page stack and animates pushes and pops.

## Try the complete flow

Open Notebook in the [NavigationShell example](../navigation-shell/index.md), add a note, then press Back. On a pointer-capable phone-style presentation, you can also try dragging inward from the leading edge while a child page is open.

`NavigationShell` combines `NavigationView` with `NavigationPage`. It supplies the page title and connects the visible Back action to `Pop()`.

## Own a stack directly when needed

For deeper flows, construct `Xui.ToolKit.UI.Mobile.Navigation.NavigationView` with a root view. `Push(view)` adds a destination; `Pop()` returns to the previous one. Check `CanGoBack` before offering an action that requires a previous page, and check `IsTransitioning` before starting a second transition.

For example, this is a method-body fragment where `navigation` is your existing `NavigationView` and `detailContent` is a fresh view:

```csharp
if (!navigation.IsTransitioning)
{
    navigation.Push(new Xui.ToolKit.UI.Navigation.NavigationPage(
        "Trail detail", detailContent, navigation.Pop));
}
```

A Back action should use the existing stack. Creating a second copy of Home would lose the user's previous page state and grow the stack in the wrong direction.

## Distinguish application Back from platform Back

The visible button and the leading-edge gesture belong to Xui's navigation control. They are not evidence that Android's system Back action, a browser history action, or a hardware key is automatically connected to the same stack. The current shell does not install those integrations. Verify the host behavior and add an explicit bridge if your application requires one.

The browser demo stays within one WebAssembly app; navigating a page does not create a browser history entry. Avoid promising URL-addressable destinations until you implement a route/history layer.

## Finish or cancel cleanly

An interactive back gesture can be cancelled. Do not commit destructive changes merely because a gesture started. Keep persisted data changes tied to explicit application actions, and release page work when the page actually deactivates or leaves its host.

For screens that contain drafts, [Page state and lifetime](../page-lifetime/index.md) explains which objects remain available after navigation.
