Skip to content

Setting BackgroundColor to null does not actually changes BackgroundColor #22914

@Jon2G

Description

@Jon2G

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

<ContentPage ... BackgroundColor="Gray"> ... </ContentPage>
public partial class MainPage : ContentPage
{
.....
	private void RestoreBackground()
	{
		this.BackgroundColor = null; // Color will remain gray
	}
.....
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-generalGeneral issues that span multiple controls, or common base classes such as View or Elementarea-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingplatform/androidplatform/iost/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions