I've basically got a Maui default test app, but I just can't figure out how I can remove the navigation bar.
I just want the gray text to be gone, and no place occupied by it (e.g. in the example, the car should be at the top of the screen).
I've tried (in Styles.xaml
)
<Style TargetType="Shell" ApplyToDerivedTypes="True">
<Setter Property="Shell.NavBarHasShadow" Value="False" />
<Setter Property="Shell.NavBarIsVisible" Value="False" />
</Style>
and in AppShell.xaml
<Shell
x:Class="MauiTest.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiTest"
Shell.FlyoutBehavior="Flyout"
Shell.NavBarIsVisible="False"
Shell.TabBarIsVisible="False">
....
</Shell>
and the same also in MainPage.xaml
and even via C#, but nothing has any effect whatsoever (other changes are applied, so it's not a build issue).
I'm currently only testing on Windows. What am I missing?
I've found it. The extended example I was looking at to see how to add more pages changed the constructor in App
as follows:
public App(INavigationService navigationService)
{
NavigationService = navigationService;
InitializeComponent();
MainPage = new NavigationPage();
// ...
}
Changing that back to MainPage = new AppShell()
(as it is in the standard example) fixed the issue. I'm still discovering Maui, so I don't really know yet what all these classes do.