> For the complete documentation index, see [llms.txt](https://functionzero.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://functionzero.gitbook.io/docs/libraries/maui.mvvmzero/configuring-your-root-page/root-navigationpage.md).

# Root NavigationPage

A common scenario is to use a `NavigationPage` as the `MainPage`. This allows stack-based navigation in your application

The goal here is to get a reference to a `NavigationPage`, push our root-page onto it, and assign the result to App.MainPage

`IPageServiceZero` and `NavigationPage` are registered in the container for us, we will have to register our pages and viewmodels ourselves:

```csharp
using FunctionZero.Maui.MvvmZero;
using SampleApp.Mvvm.Pages;
using SampleApp.Mvvm.PageViewModels;

namespace SampleApp
{
    public partial class App : Application
    {
        public App(NavigationPage navPage, IPageServiceZero pageService)
        {
            InitializeComponent();
            
            // Don't forget to call pageService.Init, or navigation will not work properly!
            pageService.Init(this);

            MainPage = navPage;
            pageService.PushPageAsync<HomePage, HomePageVm>(vm => vm.Init("Main screen turn on"));
        }
    }
}
```

Simple.
