A transient lifetime creates a new dependency-injection service instance each time it is requested. In a .NET MAUI UI app, this is useful when each page or view model should begin with clean state. section 8.2
Use transient registration when:
- A page should be recreated for each request, avoiding stale values and preserving state elsewhere. section 8.2
- A view model should provide a clean instance alongside a newly requested page. section 8.2
- A navigation style expects fresh pages, unlike Shell navigation, which commonly keeps pages as singletons. section 8.2
Registering a transient page
Register a modal LoginPage manually in MauiProgram.cs with builder.Services.AddTransient<LoginPage>();. Resolve it through dependency injection when navigation needs a new page. section 8.2.1
Table 8.2 Scope lifetimes for different dependencies in a .NET MAUI app (view table figure)
Compare recommended lifetimes for pages, view models, and services in a .NET MAUI app. section 8.2

