.Net Maui Navigation Page

Ronald Rex 1,666 Reputation points
2023-05-05T20:37:57.1033333+00:00

Hi Friends,

I was wondering how do I create a Modal NavigationPage in my shell application. I am going to try to use a Modal NavigationPage in lieu of a Popup page because I was unable to update my listview using the MVVM community toolkit using a popup page. Any help would be greatly appreciated.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,900 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,277 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,656 Reputation points Microsoft Vendor
    2023-05-06T02:44:16.27+00:00

    Hello,

    You can use Shell Navigation to do it.

    For example, if you want to navigate to the NewPage1, you should register this NewPage1 in the AppShell background code.

     public AppShell()
        {
            InitializeComponent();
           Routing.RegisterRoute("NewPage1", typeof(NewPage1));
        }
    

    Then you can navigate it by await Shell.Current.GoToAsync("NewPage1");

    If you want to pass data in navigation, you can refer this document:pass data in shell navigation

    As you said, you want to do Modal NavigationPage, if you want to hide the shell navigation bar, you can add Shell.NavBarIsVisible="False" in navigated page.

    <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 x:Class="MauiApp1.NewPage1"
                 Shell.NavBarIsVisible="False"
                 Title="NewPage1">
    

    If you have issue about ListView cannot update, please open a new thread and post related code that could reproduce this issue.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful