In .NET MAUI, a ContentPage
doesn't have the BarBackgroundColor
property, unlike the NavigationPage
and TabbedPage
. Is there another way to change the nav bar colour, such as a property in the Styles.xaml
that I'm not aware of?
CodePudding user response:
I am assuming you are using AppShell
. You can access those properties like this:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Shell.BackgroundColor="Red"
x:Class="MauiApp.MainPage">
CodePudding user response:
You can set the navigation bar color of a ContentPage
by making use of NavigationPage.TitleView
like below:
<NavigationPage.TitleView >
<Grid BackgroundColor="Yellow">
</Grid>
</NavigationPage.TitleView>