CommunityToolkit / CommunityToolkit/Maui

[BUG] StatusBarbehavior ApplyOn OnPageNavigatedTo Not Working

Open
#3,081 2 comments 3 reactions 0 assignees View on GitHub
bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

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

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

Perhaps I'm confused as to how this should work but `ApplyOn="OnPageNavigatedTo"` seems to be behaving as if it were `ApplyOn="OnBehaviorAttachedTo"`.

### Expected Behavior

My test program has 2 pages that matter - `MainPage` which sets the status bar background to green and `Page1` which sets it to red. When the program comes up `MainPage` shows a green status bar and navigating to `Page1` will show a red status bar. The problem is that navigating back to `MainPage` will show a red status bar too, not switching back to the green one.

### Steps To Reproduce

1. Open and run the solution from the repository.
2. It should initialize and show this:
Image

3. Navigate to `Page1` it should show:
Image

4. Now navigate to `Mainpage` (aka `Home`), this time it will show a red statusbar instead of a green one:
Image

### Link to public reproduction project repository

https://github.com/david-maw/StatusBar.git

### Environment

```markdown
- .NET MAUI CommunityToolkit:14.0.0
- OS: Android 36
- .NET MAUI Controls: 10.0.31
```

### Anything else?

This isn't urgent for me, working around it in code is fairly trivial.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.