question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] StatusBarBehavior StatusBarColor DynamicResource binding not working

See original GitHub issue

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

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

  1. 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:closed
  • Created 7 months ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Cybrosyscommented, Mar 6, 2023

@Cybrosys I agree that would be a great addition, please open an issue on .NET MAUI repo asking for it

https://github.com/dotnet/maui/issues/13724

0reactions
brminnickcommented, Mar 6, 2023

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 for Behaviors because of this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found