Skip to content
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

OnPlatform doesn't work with AppThemeBinding on Windows in Release mode. #19388

Closed
gairmuse opened this issue Dec 13, 2023 · 8 comments · Fixed by #24594
Closed

OnPlatform doesn't work with AppThemeBinding on Windows in Release mode. #19388

gairmuse opened this issue Dec 13, 2023 · 8 comments · Fixed by #24594
Assignees
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending t/bug Something isn't working
Milestone

Comments

@gairmuse
Copy link

gairmuse commented Dec 13, 2023

Description

Conditionally set the BackgroundColor of the MainPage of a new project using OnPlatform and AppThemeBinding and it will not work in Release mode. Works fine in Debug mode.
BackgroundColor="{OnPlatform WinUI={AppThemeBinding Dark=Yellow, Light=Blue, Default=White}, Default=Green}"

The page renders with a black background (in Dark mode).

Steps to Reproduce

Create new .NET 8.0 MAUI App project in Visual Studio then add the following line to MainPage.xaml inside ContentPage.
BackgroundColor="{OnPlatform WinUI={AppThemeBinding Dark=Yellow, Light=Blue, Default=White}, Default=Green}"

Link to public reproduction project repository

https://github.com/gairmuse/MauiOnPlatformBug

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.101

Affected platforms

Windows

Affected platform versions

Windows 10.0.19041.0

Did you find any workaround?

Not really. BackgroundColor can be set in code.

Relevant log output

No response

@gairmuse gairmuse added the t/bug Something isn't working label Dec 13, 2023
@jsuarezruiz jsuarezruiz added area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 labels Dec 13, 2023
@PureWeen PureWeen added the potential-regression This issue described a possible regression on a currently supported version., verification pending label Dec 18, 2023
@PureWeen PureWeen added this to the Backlog milestone Dec 18, 2023
@ghost
Copy link

ghost commented Dec 18, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@vhugogarcia
Copy link
Contributor

This issue also occurs on iOS and Android. cc: @jsuarezruiz do you know if this issue is already fixed by a PR? Thanks in advance.

@MartyIX
Copy link
Contributor

MartyIX commented Jul 23, 2024

@vhugogarcia Cheers. Is it possible that the bug is fixed? I ran a sample MAUI app on Mac Catalyst using

dotnet build -t:run -c Release  --framework net8.0-maccatalyst

and it produced:

Screen.Recording.2024-07-23.at.15.24.13.mov

XAML was as follows:

<Label
    Text="Hello, World!"
    Style="{StaticResource Headline}"
    SemanticProperties.HeadingLevel="Level1" 
    BackgroundColor="{OnPlatform MacCatalyst={AppThemeBinding Light=Blue, Dark=Yellow, Default=White}, Default=Green}"/>

and it looks OK to me.

I can test on Windows later on.

@vhugogarcia
Copy link
Contributor

Thanks @MartyIX , it is probably fixed, yes 😃 . Could you give us a hand to test it on iOS, Android and Windows as well? please 🙏🏻

@MartyIX
Copy link
Contributor

MartyIX commented Jul 23, 2024

I can easily test on Windows.

Not so much experience with iOS and Android but I guess I can learn some new stuff.

@vhugogarcia
Copy link
Contributor

I can easily test on Windows.

Not so much experience with iOS and Android but I guess I can learn some new stuff.

Sounds good, let us know the results. Thank you!

@gairmuse
Copy link
Author

@MartyIX The issue was reported on Windows. Not sure there is any value testing on Mac.

@MartyIX
Copy link
Contributor

MartyIX commented Jul 23, 2024

@MartyIX The issue was reported on Windows. Not sure there is any value testing on Mac.

I did that simply because of this comment which sort of suggested that the problem is on all platforms: #19388 (comment)

Anyway, on Windows in the release configuration it behaves like this with the latest released version:

animation

So it's not fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending t/bug Something isn't working
Projects
None yet
6 participants