[BUG] StatusBarBehavior StatusBarColor DynamicResource binding not working
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Did you read the “Reporting a bug” section on Contributing file?
- 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
I am trying to bind the StatusBarColor
of StatusBarBehavior
using a DynamicResource
-binding, to support theming:
<ContentPage.Behaviors>
<toolkit:StatusBarBehavior StatusBarColor="{DynamicResource Tertiary}" />
</ContentPage.Behaviors>
This results in the StatusBarColor being white/transparent instead of the Tertiary color.
Using a StaticResource
-binding works as expected.
I have only tested this on Android but @brminnick was able to reproduce it on iOS.
Expected Behavior
The status bar color should reflect the color referenced by the DynamicResource
-binding.
Steps To Reproduce
- Open and run the sample on Android and iOS
Link to public reproduction project repository
https://github.com/Cybrosys/Sandbox/tree/master/MauiAppStatusBarColorDynamicResource
Environment
- .NET MAUI CommunityToolkit: 5.0.0
- OS: Android Emulator running Android 13.0 - API 33
- .NET MAUI: 7.0.59/7.0.100 VS 17.5.33424.131
Anything else?
No response
Issue Analytics
- State:
- Created 7 months ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Behavior bindable property with DynamicResource not ...
It is a question related to doing a DynamicResource binding against a bindable property on the StatusBarBehaior , if it is supported or...
Read more >DynamicResource binding to Color not working
First thing you need to do is turn up debug messages for databinding: i.stack.imgur.com/MF8i5.png Next, re-run and check the output window and ...
Read more >StatusBarBehavior - .NET MAUI Community Toolkit
The StatusBarBehavior is a behavior allows you to control the statusbar's style.
Read more >Change Status Bar Color for Android and iOS in .NET MAUI
NET MAUI Community Toolkit you now get the StatusBarBehavior which allows you to change the status bar color in your app very easily...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://github.com/dotnet/maui/issues/13724
Thanks @Cybrosys!
I agree with @pictos. We get a lot of Issues opened here in the
CommunityToolkit.Maui
repo when things like DynamicResources and Bindings don’t work as expected forBehavior
s because of this.