.NET MAUI Shell Navigation: Routes, Query Parameters, and Navigation

.NET MAUI Shell provides a centralized navigation model based on routes. It can simplify page navigation, deep links, and passing small pieces of state between pages.

Register a Route

Routing.RegisterRoute("details", typeof(DetailsPage));

The route name becomes the stable identifier used by navigation code rather than relying on page construction at every call site.

Navigate to a Route

await Shell.Current.GoToAsync("details");

Pass Query Parameters

await Shell.Current.GoToAsync("details?id=42");

For more structured navigation, use Shell's query-property support or a navigation state object rather than placing large amounts of data in the URL-like route.

Receive Parameters

[QueryProperty(nameof(ProductId), "id")]
public partial class DetailsPage : ContentPage
{
    public string ProductId { get; set; }
}

Navigation Should Stay Simple

Pass identifiers and small values through navigation. For complex application state, use a service or view-model rather than turning navigation parameters into a global data store.

Back Navigation

await Shell.Current.GoToAsync("..");

Using relative routes keeps the page decoupled from the full navigation hierarchy.

Common Mistakes

Conclusion

Shell navigation works best when routes remain predictable and navigation carries only the small amount of state needed to identify the destination.

Back to .NET MAUI Tutorials

🤖 AlgoLassi Assistant Have a question about this tutorial?

Ask AlgoLassi and get an answer plus the tutorials worth studying next.

Ask a question

đŸ’Ŧ Comments

Sign in with Google to publish immediately, or comment anonymously and wait for approval.

Comments will appear here when available.