CommunityToolkit / CommunityToolkit/Maui
[BUG] Setting Android using NavigationBar.Color in xaml or code permanently changes the navigationBar color everywhere rather than just that ContentPage
- 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
Setting the NavigationBar.Color in xaml or code sets it app wide. This is easy to do using Android styles.xml and colors.xml anyway.
### Expected Behavior
I would expect the color to only be changed for the specifc ContentPage I was on, so that in my own applications I can set specific colours for specific screens for a specific look and feel.
### Steps To Reproduce
Run the sample app on Android and navigate to Platform Specific -> NavigationBar.
Use the slider to set the NavigationBar color like so:
And then navigate away from this screen:
### Link to public reproduction project repository
https://github.com/CommunityToolkit/Maui/tree/main/samples/CommunityToolkit.Maui.Sample/Pages/PlatformSpecific
### Environment
```markdown
- .NET MAUI CommunityToolkit:9.0.1
- OS: Android
- .NET MAUI: 8.0.300 (I think)
```
### Anything else?
Thanks!
Contributor guide
Research direction
Start by running the sample app from samples/CommunityToolkit.Maui.Sample/Pages/PlatformSpecific on Android and reproduce the NavigationBar color change with the slider. Trace how NavigationBar.Color is applied when navigating between ContentPage instances. Done means a color set on one page does not remain app-wide and the behavior is covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, csharp
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100