-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BoxView is rendered always with a black background #10850
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
@jsuarezruiz Unfortunately, it has not fixed. I have tried it with MAUI 6.0.547 that has been released a few days ago. I have also upgraded the repro project to .NET 7 a tried it with the latest MAUI 7.0.49. Nothing changed. The color bug is still there. The other bugs that I have mentioned are still there, too. |
Confirmed MAUI 7.0.49 |
Workaround, thanks to reading the thread @HausBJB posted: |
@BioTurboNick Thank you, the workaround works. But it can be used only for a single color. It cannot be used for example for a LinearGradientBrush. So Background and BackgroundColor does not work, but Color does. What is the difference between Color and BackgroundColor anyway? Why has MAUI two properties for exactly the same thing? This is very confusing. |
My guess is that the default Styles.xaml dictionary, which sets Color on all BoxView objects, is silencing the BackgroundColor property. That other issue says that if Color is set, it will be used instead of BackgroundColor.
EDIT: Confimed, if you delete this Styles.xaml entry or change it to BackgroundColor, BackgroundColor works again. |
Description
Background and BackgroundColor properties of BoxView do not work. They are ignored completely and the BoxView has always a black background instead. This has already been reported a few months ago, but the issue has been closed for inactivity (despite the fact that it got some reactions): #9292
I am reporting the same issue and I have created a repro project to make the reproduction of the bug as simple as possible:
https://github.com/holecekp/MauiBoxViewBug
The repro project contains a VerticalStackLayout with a BoxView, Frame, and Rectangle.
The result should be a red, green, and blue rectangle with the same height. You can see in the screenshots that the result is very far from what is expected. The BoxView is not red but black instead. You can see two other bugs in this very simple example: the height of the controls is incorrect (the Frame is too big on Android, and the Rectangle is too small on Windows), and the zero spacing set for the VerticalStackLayout is ignored for Windows.
Screenshot for Windows - notice the black box instead of the red one (and other bugs)
Screenshot for Android - notice the black box instead of the red one
Steps to Reproduce
Link to public reproduction project repository
https://github.com/holecekp/MauiBoxViewBug
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows, I was not able test on other platforms
Affected platform versions
Windows 10, Android 12 but it probably does not work anywhere
Did you find any workaround?
No. In very simple cases (like the one in the repro project), you can try Frame, or Rectangle as a replacement for BoxView, but, it might be impossible to find a workaround in more complex real-life scenarios. I have not been able to find a sufficient replacement for BoxView for my app because Frame and Rectangle have they their own positioning bugs when more complex layouts are used. When you need to use a LinearGradientBrush instead of a solid color, you can expect another differences in the three controls so I found it impossible to workaround the issue in a more complex realistic scenario.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: