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

Setting Foreground on MenuBarItem doesn't work #7070

Closed
1 of 2 tasks
eerhardt opened this issue May 6, 2022 · 5 comments
Closed
1 of 2 tasks

Setting Foreground on MenuBarItem doesn't work #7070

eerhardt opened this issue May 6, 2022 · 5 comments
Labels
area-Menus bug Something isn't working fix-released The fix has been in a release (experimental, preview, stable, or servicing). product-winui3 WinUI 3 issues team-Controls Issue for the Controls team
Milestone

Comments

@eerhardt
Copy link
Member

eerhardt commented May 6, 2022

Describe the bug

Setting the Foreground property on a MenuBarItem or a MenuBar doesn't affect the text color of the menu.

Steps to reproduce the bug

  1. Create a Blank WinUI 3 app
  2. In the MainPage add the following xaml:
        <MenuBar Foreground="White" Background="Black">
            <MenuBarItem Title="File" Foreground="White" />
            <MenuBarItem Title="Edit" Foreground="White">
                <MenuFlyoutItem Text="Cut" Foreground="LightSeaGreen"/>
                <MenuFlyoutSeparator />
                <MenuFlyoutItem Text="Copy" Foreground="Blue"/>
                <MenuFlyoutSubItem Text="Other" Foreground="LightSteelBlue">
                    <MenuFlyoutItem Text="Delete" Foreground="Black"/>
                </MenuFlyoutSubItem>
            </MenuBarItem>
        </MenuBar>
  1. Run the app

Expected behavior

I expect to be able to read the Menu items because I set the Background to black and the Foreground to White.

I'm not sure whether setting the MenuBar Foreground should affect all the MenuBarItems inside of it or not. I can see advantages to both.

Interesting is that MenuFlyoutItem and MenuFlyoutSubItem Foreground appears to work. It is just MenuBarItem that doesn't.

Screenshots

Notice that File and Edit aren't readable in the MenuBar.

image

NuGet package version

WinUI 3 - Windows App SDK 1.0.3

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

Windows 10 (21H2): Build 19044

Additional context

No response

@eerhardt eerhardt added the bug Something isn't working label May 6, 2022
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label May 6, 2022
eerhardt added a commit to eerhardt/maui that referenced this issue May 9, 2022
Windows MauiToolbar is not respecting the BarTextColor in the MenuBar. Currently, BarTextColor is only setting the Title's Foreground. If someone sets the BarBackgroundColor, and the BarTextColor is ignored, you can get a menu bar that is not readable.

The fix is to propagate the BarTextColor to the MenuBar. However, the fix isn't as simple due to microsoft/microsoft-ui-xaml#7070. Working around that issue by setting the Button's Foreground colors in the MenuBar's ResourceDictionary.

Fix dotnet#5554
PureWeen pushed a commit to dotnet/maui that referenced this issue May 9, 2022
* Respect BarTextColor in Windows MenuBar

Windows MauiToolbar is not respecting the BarTextColor in the MenuBar. Currently, BarTextColor is only setting the Title's Foreground. If someone sets the BarBackgroundColor, and the BarTextColor is ignored, you can get a menu bar that is not readable.

The fix is to propagate the BarTextColor to the MenuBar. However, the fix isn't as simple due to microsoft/microsoft-ui-xaml#7070. Working around that issue by setting the Button's Foreground colors in the MenuBar's ResourceDictionary.

Fix #5554

* Respond to PR feedback

- Allow for clearing the MenuBar Foreground property.
- Ensure that we only set the foreground if someone actually set the BarTextColor.

* Don't set the Title.Foreground to null.
@ojhad ojhad added area-Menus team-Controls Issue for the Controls team product-winui3 WinUI 3 issues and removed needs-triage Issue needs to be triaged by the area owners labels May 16, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
@eerhardt
Copy link
Member Author

eerhardt commented Aug 4, 2023

I don't believe this has been fixed has it? Can it be re-opened?

@JoeTomkinson
Copy link

This is still a problem, in-fact the same issue was reported against the WinUI-Gallery application #9241

If the theme of the application changes from light to dark, or dark to light, the flyout style doesn't appropriately change. This is a bug and should be marked for triage.

Seems to me as though this has been present for at least 12 months maybe longer.

@cosmin42
Copy link

Any known workaround?

@karkarl
Copy link
Contributor

karkarl commented Feb 15, 2024

Fixed in internal PR: 10250839

@karkarl karkarl closed this as completed Feb 15, 2024
@codendone codendone added this to the WinAppSDK 1.6 milestone Feb 16, 2024
@codendone codendone added the fix-released The fix has been in a release (experimental, preview, stable, or servicing). label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Menus bug Something isn't working fix-released The fix has been in a release (experimental, preview, stable, or servicing). product-winui3 WinUI 3 issues team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

6 participants