Back button in content page not disabled

Dani_S 4,501 Reputation points
2023-06-19T12:45:43.63+00:00

Hi,

The back button on the left side of the page not disabled, why ?

I used net 7 + vs 7.6.3 last version.

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="GssdDesktopClient.Maui.Pages.MainPage"
             xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
             xmlns:CustomControls ="clr-namespace:GssdDesktopClient.Maui.CustomControls"
             FlowDirection ="LeftToRight" NavigationPage.HasBackButton="False" NavigationPage.HasNavigationBar="False">

1.Windows platform.

2.After login I set :

    await Application.Current.MainPage.Navigation.PushAsync(new MainPage(), true);

3.Is not connected to LTR mode.

Developer technologies | .NET | .NET MAUI
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2023-06-22T01:27:07.7866667+00:00

    Hello,

    In App class, you set AppShell as the root page.

    public App()
        {
            InitializeComponent();
           MainPage = new AppShell();
        }
    

    So you could try setting Shell.NavBarIsVisible and Shell.BackButtonBehavior in the Page.

    <ContentPage ...
                 Shell.NavBarIsVisible="False">
        <Shell.BackButtonBehavior>
            <BackButtonBehavior IsVisible="False" />
        </Shell.BackButtonBehavior>
       ...
    </ContentPage>
    

    For more details, please refer to .NET MAUI Shell navigation - .NET MAUI | Microsoft Learn

    Best Regards,

    Wenyan Zhang


    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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.