dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.75k forks source link

[iOS/Android] Setting Background to null will not update rendering (for example Label.Background = null after it was set to Yellow stays Yellow) #24725

Closed spadapet closed 1 month ago

spadapet commented 1 month ago

Description

In iOS and Android, when Background was set to null, the platform element's Background was not changed at all (except for Layouts). This should apply to any elements, such as Labels.

Steps to Reproduce

  1. Open MAUI repo and solution that contains the Sandbox project in VS 2022 latest version:
    • image
  2. Set target to Android
  3. F5 to build and debug
  4. Open MainPage.xaml in the Sandbox project
  5. Type this Label:
    • <Label Text="Foo" Background="Yellow" />
  6. Notice that the app has the yellow label:
    • image
  7. Delete the Background property:
    • <Label Text="Foo" />

RESULT: The Label is still Yellow in the app (XAML Hot Reload does remove the property value)

EXPECT: Not Yellow anymore

Link to public reproduction project repository

https://github.com/dotnet/maui

Version with bug

9.0.0-rc.1.24453.9

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

No response

Did you find any workaround?

You can set a Transparent background brush instead of null. But a fix is still needed for XAML Hot Reload to work properly.

Relevant log output

No response

github-actions[bot] commented 1 month 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!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

spadapet commented 1 month ago

Yeah, the AI bot found a dupe:

22914

mattleibow commented 1 month ago

Duplicate of https://github.com/dotnet/maui/issues/22914