Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

FIX: [BUG] Using StatusBarBehavior Breaks StatusBar.SetColor() #3197 API36 - #3202

#3202
Merged
TheCodeTraveler merged 10 commits into
CommunityToolkit:mainCommunityToolkit/Maui:mainfrom
Pastajello:bugfix/3197-api-36-color-statusbarPastajello/CommunityToolkit.Maui:bugfix/3197-api-36-color-statusbarCopy head branch name to clipboard
Apr 15, 2026
Merged

FIX: [BUG] Using StatusBarBehavior Breaks StatusBar.SetColor() #3197 API36#3202
TheCodeTraveler merged 10 commits into
CommunityToolkit:mainCommunityToolkit/Maui:mainfrom
Pastajello:bugfix/3197-api-36-color-statusbarPastajello/CommunityToolkit.Maui:bugfix/3197-api-36-color-statusbarCopy head branch name to clipboard

Conversation

@Pastajello

@Pastajello Pastajello commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Description of Change

The change check for already created statusBarOverlay in the Action run on MessageQueue.

Producing a sample is actually difficult as it requires changing the BehaviorsGalleryPage.Behaviors since first succesfull creation of statusBarOverlay is then reused in the app.

The case can be tested by simply commenting out some code in BehaviorsGalleryPage:

#if ANDROID || IOS
	void AddStatusBarBehavior()
	{
		Behaviors.Add(new CommunityToolkit.Maui.Behaviors.StatusBarBehavior
		{
			StatusBarColor = Color.FromRgb(25, 118, 210),
			StatusBarStyle = Core.StatusBarStyle.LightContent,
			//ApplyOn = CommunityToolkit.Maui.Behaviors.StatusBarApplyOn.OnPageNavigatedTo,
		});
	}
#endif

Before After
before after

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls Fixing a bug.

Additional information

@Pastajello Pastajello changed the title FIX: [BUG] Using StatusBarBehavior Breaks StatusBar.SetColor() #3197 FIX: [BUG] Using StatusBarBehavior Breaks StatusBar.SetColor() #3197 API36 Apr 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an Android API 36-specific regression where using StatusBarBehavior can interfere with later calls to StatusBar.SetColor(), by avoiding duplicate creation of the status bar overlay view.

Changes:

  • Add a secondary “already created overlay” check inside the DecorView.Post callback to prevent creating multiple overlays on Android API 36+.

…droid.cs


Apply to already created overlay

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@TheCodeTraveler
TheCodeTraveler enabled auto-merge (squash) April 15, 2026 16:04
@TheCodeTraveler
TheCodeTraveler merged commit 6c4f8c4 into CommunityToolkit:main Apr 15, 2026
9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Using StatusBarBehavior Breaks StatusBar.SetColor()

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.