Skip to content

[BUG] StatusBarBehavior has no effect when trying to change color in dotnet 10 on Android #3052

@spuliy

Description

@spuliy

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When adding using StatusBarBehavior, the color of the status bar does not change.

AppShell.xaml

<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="MauiApp3.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MauiApp3"
		xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
    Title="MauiApp3" Shell.NavBarIsVisible="False">
	<Shell.Behaviors>
		<toolkit:StatusBarBehavior StatusBarColor="Red" StatusBarStyle="DarkContent"/>
	</Shell.Behaviors>
    <ShellContent

        Title="Home"
        ContentTemplate="{DataTemplate local:MainPage}"
        Route="MainPage" />

</Shell>

MainPage.xaml

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp3.MainPage" SafeAreaEdges="Container">
	<Grid RowDefinitions="Auto, *">
		<Grid 

				RowSpacing="0"
				ColumnSpacing="0"
				BackgroundColor="LightBlue"
				Margin="{OnPlatform iOS='0,-10,0,0'}">
				<Grid.HeightRequest>
					<OnPlatform
						x:TypeArguments="x:Double">
						<On Platform="iOS" Value="56"/>
						<On Platform="Android" Value="56"/>
					</OnPlatform>
				</Grid.HeightRequest>

				<ContentView
        HorizontalOptions="Start"
        VerticalOptions="FillAndExpand"
        Grid.Row="0"
        Grid.Column="0">
					<ContentView.WidthRequest>
						<OnPlatform
                x:TypeArguments="x:Double">
							<On Platform="iOS" Value="46"/>
							<On Platform="Android" Value="56"/>
						</OnPlatform>
					</ContentView.WidthRequest>
					<Image
            VerticalOptions="Center"
            HorizontalOptions="Center"
            Source="dotnet_bot.png"
            WidthRequest="26"
            HeightRequest="26">
					</Image>
					<ContentView.GestureRecognizers>
						<TapGestureRecognizer Command="{Binding MenuButtonTappedCommand, Source={x:Reference toolbarRoot}}"/>
					</ContentView.GestureRecognizers>
				</ContentView>

			<Label Text="CUSTOM TOOLBAR"/>
		</Grid>
		<Grid Grid.Row="1" BackgroundColor="Green">
			<Label Text="test"/>
		</Grid>
	</Grid>

</ContentPage>

Image

Expected Behavior

When setting StatusBarColor="Red", the status bar should be Red as it was in dotnet 9.

Steps To Reproduce

1.) Use Community Tool Kit.
2.) Copy and paste provided code in respective files.

Link to public reproduction project repository

https://github.com/spuliy/StatusBarIssueRepo

Environment

- .NET MAUI CommunityToolkit: 13.0.0
- OS: Android 15 - API 35
- .NET MAUI: (Microsoft.Maui.Controls) 10.0.30

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions