Prism and Navigation

Hello Guys, I'm having a problem when navigating with Prism.
If I create a NavigationPage and simply call _navigationService.NavigateAsync("nameOfTheNavigationPage"), I'm getting an unhandled exception: "System.InvalidOperationException: Sequence contains no elements".

If I create this Page as a ContentPage, I don't get this error.

Does somebody know a better way of doing this?

In App.xaml.cs, I start the application with NavigationService.NavigateAsync("LoginPage"); but LoginPage is not a NavigationPage.


  • BrianLagunasBrianLagunas USInsider ✭✭✭✭

    You can't navigate to an empty NavigationPage. When you initially navigate to a navigationPage, you must specify the view to push onto the NavigationPage in your URI. You need something like:


  • JorgeGironJorgeGiron USMember

    I have a similar problem, i want star first NavigationService.NavigateAsync("NavigationPage/LoginPage") but after i validate the user i want to go to a MasterDetailPage called MainPage i put NavigationService.NavigateAsync("MainPage/NewsPage"), work nice but i don't want that show the back arrow after login (<- Main), i dont want back to login.

  • BrianLagunasBrianLagunas USInsider ✭✭✭✭

    Than you need to perform an absolute navigation. This is done by prefixing your uri with a "/".


    This will reset your App.MainPage

  • MO35ABMO35AB Member
    edited January 16

    No need to open new question, i ll just ask here
    Having similar problem, but i have Login page => Masterdetailpage that uses A Navigation page as its Detail content.
    I start the app by navigating to : Login page, from there i navigate to /MasterdetailPage/Home.
    if i wanted to make Home and any other page go inside a MasterDetailPage.Detail ( that is the navigation page ), how should i navigate ?

    here is the code :

        <MasterDetailPage xmlns=""
                <ContentPage Title="Menu" Visual="Default">
            <!-- help me here -->
        async void UserAuthenticatedAsync()
                        var p = new NavigationParameters();
                        p.Add("user", Username);
                // and here
                        await _navigationService.NavigateAsync("/MasterPage/Home", p);
Sign In or Register to comment.