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

[regression/8.0.0-preview.4.8333] Windows application frame is now black #16969

Closed
hilmican-yuksel opened this issue Aug 24, 2023 · 17 comments · Fixed by #17528
Closed

[regression/8.0.0-preview.4.8333] Windows application frame is now black #16969

hilmican-yuksel opened this issue Aug 24, 2023 · 17 comments · Fixed by #17528
Assignees
Labels
area-controls-window Window fixed-in-8.0.0-rc.2.9511 Look for this fix in 8.0.0-rc.2.9511 i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Milestone

Comments

@hilmican-yuksel
Copy link

hilmican-yuksel commented Aug 24, 2023

Description

Windows Application Frame color is black on net8.0-windows10.0.19041.0

Screenshot 2023-08-24 102705

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.0-preview.4.8333

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.0-preview.3.8149

Affected platforms

Windows

Affected platform versions

windows10.0.19041.0

Did you find any workaround?

No response

Relevant log output

No response

@hilmican-yuksel hilmican-yuksel added the t/bug Something isn't working label Aug 24, 2023
@jfversluis jfversluis added the s/needs-repro Attach a solution or code which reproduces the issue label Aug 24, 2023
@ghost
Copy link

ghost commented Aug 24, 2023

Hi @hilmican-yuksel. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@samhouts samhouts added i/regression This issue described a confirmed regression on a currently supported version area-controls-window Window labels Aug 28, 2023
@samhouts samhouts added this to the .NET 8 GA milestone Aug 28, 2023
@samhouts samhouts changed the title Windows application frame [regression/8.0.0-preview.7.8842] Windows application frame is now black Aug 28, 2023
@ghost ghost added the s/no-recent-activity Issue has had no recent activity label Sep 1, 2023
@ghost
Copy link

ghost commented Sep 1, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@jeremy-visionaid
Copy link
Contributor

I also observe this upgrading to 8.0.0-preview.7.8842

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue s/no-recent-activity Issue has had no recent activity labels Sep 3, 2023
@PureWeen PureWeen added s/needs-repro Attach a solution or code which reproduces the issue and removed s/needs-attention Issue has more information and needs another look labels Sep 3, 2023
@ghost
Copy link

ghost commented Sep 3, 2023

Hi @hilmican-yuksel. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@jeremy-visionaid
Copy link
Contributor

Here's a repo - just a new .NET MAUI App template switched to dotnet 8:

https://github.com/molesmoke/MauiTestApp/tree/dotnet8

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Sep 3, 2023
@jeremy-visionaid
Copy link
Contributor

@PureWeen Looks like this was caused by #14517

@PureWeen
Copy link
Member

PureWeen commented Sep 4, 2023

@jeremy-visionaid hmm is it a particular version of windows or OS level styling you have set?

I created a new template and using light theme everything look white to me.

image

NET7 does style with a slightly different grey

image

But I'm not seeing black.

Your sample
image

@jeremy-visionaid
Copy link
Contributor

jeremy-visionaid commented Sep 4, 2023

@PureWeen Ah yup, looks like it's not default Windows behaviour, looks like both @hilmican-yuksel and I are running with:
"Show accent colour on title bars and window borders" in "Settings -> Personalisation -> Colours"

Also looks like you're running the main branch - the repro for this issue is on the dotnet8 branch (I have a branch per MAUI bug).

Overall, it's obviously not a major one, but I write apps for visually impaired users, so style/consistency and usability for high contrast/custom DPI/scaling, accessibility etc. is particuarly important to that group. Ideally I'd like to be able to follow the underlying WinUI themes closely (though that also has its own problems).

With the lack of consistency between Microsoft's UI frameworks, I'm not sure what the "correct" behaviour should be here. But I'd guess it should at least be all one way or all the other, and preferably configurable via styles/themes.

@samhouts samhouts added potential-regression This issue described a possible regression on a currently supported version., verification pending and removed i/regression This issue described a confirmed regression on a currently supported version labels Sep 5, 2023
@Foda
Copy link
Member

Foda commented Sep 5, 2023

@jeremy-visionaid: In the dotnet8 branch we set a custom titlebar by default -- but don't override the caption buttons so they default to the behavior of using the Windows theme settings. We should probably just make the default behavior for the caption buttons to have a transparent background w/ the correct text foreground resource.

However, for now, you can work around this by setting the caption button colors manually. This might be better anyways since you're designing for visually impaired users and gives you more consistent control.

To do this for an app with a Light theme you can add the following code to your MauiProgram.CreateBuilder logic:

#if WINDOWS
builder.ConfigureLifecycleEvents(events =>
{
    events.AddWindows(windows =>
        windows.OnWindowCreated(window =>
        {
            window.AppWindow.TitleBar.ButtonBackgroundColor = Microsoft.UI.Colors.Transparent;
            window.AppWindow.TitleBar.ButtonForegroundColor = Microsoft.UI.Colors.Black;
        }));
});
#endif

@jeremy-visionaid
Copy link
Contributor

@Foda Thanks for the workaround. I need something that works adaptively to system settings and theme changes, but I'm sure I can come up with something from there. 👍

@samhouts samhouts added i/regression This issue described a confirmed regression on a currently supported version and removed potential-regression This issue described a possible regression on a currently supported version., verification pending labels Sep 8, 2023
@samhouts samhouts changed the title [regression/8.0.0-preview.7.8842] Windows application frame is now black [regression/8.0.0-preview.4.8333] Windows application frame is now black Sep 8, 2023
@samhouts
Copy link
Member

samhouts commented Sep 8, 2023

Confirmed that this regressed between 8.0.0-preview.3.8149...8.0.0-preview.4.8333. #14517 is most sus (thanks @jeremy-visionaid!). I would think that the buttons and the bar would all be the same color, so it does look a bit weird. Also, my accent colors are now red and yellow from testing this. #hotdogstandforever

@pledi
Copy link

pledi commented Sep 19, 2023

Before I was able to change the TitleBar Color with changing the window's ExtendsContentIntoTitleBar Property to true and setting the color of the WindowCaptionBackground Resource, now that doesnt work anymore.

Anyone already got a workaround for changing the Titlebar Color dynamically?

Edit: ah I see, we moved to AppWindow and https://learn.microsoft.com/en-us/windows/apps/develop/title-bar?tabs=wasdk tells me that

// Set active window colors
// Note: No effect when app is running on Windows 10 since color customization is not
// supported.

I'm stuck with a black bar on Window 10.

@PureWeen PureWeen moved this from Todo to In Progress in MAUI SDK Ongoing Sep 24, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing Sep 27, 2023
Foda added a commit that referenced this issue Sep 27, 2023
### Description of Change

* Apply user accent color to the title bar when the setting "Show accent
color on title bars and windows borders" is enabled
* React to changes in user accent color
* When accent color on title bars are disabled: align the default title
bar color to use the Mica material when supported



| Before      | After |
| ----------- | ----------- |

|![before_dark](https://github.com/dotnet/maui/assets/890772/2a85c32c-5b81-47e9-92f2-939bfec38e8a)
|
![after_dark](https://github.com/dotnet/maui/assets/890772/8f6a7626-dc2b-4c3e-91ab-4130f825d108)
|

|![before_dark_accent](https://github.com/dotnet/maui/assets/890772/397fd23d-9645-4001-b316-6c0f7ce31007)
|
![after_dark_accent](https://github.com/dotnet/maui/assets/890772/8a668776-8eca-4689-9e02-8e39fb549b43)
|

|![before_light](https://github.com/dotnet/maui/assets/890772/78dcc229-4a23-4de4-ad4e-53b839ce4dfc)
|![after_light](https://github.com/dotnet/maui/assets/890772/e19390f9-4ea2-4cc1-8728-376f0b50217f)|

|![before_light_accent](https://github.com/dotnet/maui/assets/890772/ab68eef6-8707-487f-9178-eacdcd886914)|![after_light_accent](https://github.com/dotnet/maui/assets/890772/e82065b4-b024-4441-8755-7a1677acf043)|


### Visual Reference: Notepad

**Dark**

![ref_notepad_dark](https://github.com/dotnet/maui/assets/890772/d77be3d8-006d-4dcb-8146-3a71c0f560dc)

**Light**

![ref_notepad_light](https://github.com/dotnet/maui/assets/890772/f082a144-c9e9-45f7-8343-078803d39187)

### Issues Fixed

Fixes #16969
@pledi
Copy link

pledi commented Oct 17, 2023

I think this is still not fixed in RC2. @Foda
If I start my application with the OS Theme set to Dark, I do have a black window border.
If I start it with Light Mode, it's white.

I do need to provide a theme switch option in my application, and therefore I need to toggle between both light and dark mode at runtime. On Xamarin I did this by setting ExtendsContentIntoTitleBar to true, and overriding WindowCaptionBackground. On RC2 on Windows 10 this results in the following:

window

So for me the Window application frame is still black (or white if I switch the OS Theme). That little box on the right it by way the Color set for WindowCaptionBackground, on .Net 7 this filled the whole frame.

@ghost
Copy link

ghost commented Oct 17, 2023

Hello lovely human, thank you for your comment on this issue. Because this issue has been closed for a period of time, please strongly consider opening a new issue linking to this issue instead to ensure better visibility of your comment. Thank you!

@jeremy-visionaid
Copy link
Contributor

jeremy-visionaid commented Oct 26, 2023

@Foda I concur with @pledi, the issue remains in RC2 and this issue should be reopened.

However, my expectations of the correct behaviour is different. For other WinUI 3 apps, the user accent does not apply to the caption buttons - and this should probably be the default behaviour for MAUI. At least it should be all one way or all another, not the current half and half of the current situation.

I can get reasonable behavior through lifecycle events (but you also need to set inactive colours and respond to theme changes), so thanks for the hints for the workaround.

@ghost
Copy link

ghost commented Oct 26, 2023

Hello lovely human, thank you for your comment on this issue. Because this issue has been closed for a period of time, please strongly consider opening a new issue linking to this issue instead to ensure better visibility of your comment. Thank you!

@jeremy-visionaid
Copy link
Contributor

@Foda @pledi Looks good in 8.0.0-rc.2.9511

@ghost ghost locked as resolved and limited conversation to collaborators Dec 1, 2023
@samhouts samhouts added the fixed-in-8.0.0-rc.2.9511 Look for this fix in 8.0.0-rc.2.9511 label Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-window Window fixed-in-8.0.0-rc.2.9511 Look for this fix in 8.0.0-rc.2.9511 i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants