Open Jon2G opened 5 months ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
@Jon2G what if you call "ClearValue" vs setting it to null?
If nothing has changed in the last 2 ish years then this is explicitly not supported. #1485 and #5317
@PureWeen calling "ClearValue" instead of setting property to null seems to work, i have updated the reproduction project. https://github.com/Jon2G/MAUI-BackgroundColorNull
@PureWeen I'm afraid i find a case where "ClearValue" does not works.
If you define a Style for the View without setting a "default" backgroundColor it will fail to clear the value
`
<!--<Setter Property="BackgroundColor" Value="Transparent" />-->
<Setter Property="LineBreakMode" Value="WordWrap" />
`
A simple label
<Label x:Name="labelTest" BackgroundColor="Gray" Text="This text should be visible" TextColor="Gray" />
Then try to remove gray background with:
labelTest.ClearValue(Label.BackgroundColorProperty); //this DON'T work
I have updated the reproduction project. https://github.com/Jon2G/MAUI-BackgroundColorNull
@PureWeen What do you recommend we do in the above mentioned case?
Description
Probably root cause of #19576 Android/iOS (Windows works fine) If you set the BackgroundColor to null nothing will happen.
Steps to Reproduce
Simply try to change BackgroundColor of a Page to null by binding or directly
https://github.com/Jon2G/MAUI-BackgroundColorNull/raw/main/Capture.PNG
Link to public reproduction project repository
https://github.com/Jon2G/MAUI-BackgroundColorNull
Version with bug
8.0.40 SR5
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android
Affected platform versions
Android 33,34
Did you find any workaround?
If you set the BackgroundColor to transparent or any other it will work but its not optimal
Relevant log output
No response