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

Disabling a MenuFlyoutItem loses it's style when theme != application defualt #8894

Open
DHancock opened this issue Sep 20, 2023 · 0 comments
Labels
area-Flyouts bug Something isn't working team-Controls Issue for the Controls team

Comments

@DHancock
Copy link

Describe the bug

If you change a MenuFlyoutItem's state to disabled inside the menu item's ICommand.Execute() implementation by calling it's ICommand.CanExecuteChanged.Invoke() method, while the app's theme is dark and the default system theme is light, the next time it's containing menu is opened the MenuFlyoutItem text is drawn with a black foreground, irrelevant of it's style.

Steps to reproduce the bug

  1. Run the attached project with the system theme set to light.
  2. Click the toggle theme button.
  3. Open the Demo menu.
  4. Note that the last MenuFlyoutItem is current enabled.
  5. Select that menu item.
  6. Reopen the Demo menu
  7. The last menu item is now drawn in black.

Min repro project:
MenuFlyoutItem_Issue.zip

Expected behavior

No response

Screenshots

Recording.2023-09-20.155109.mp4

NuGet package version

None

Windows version

Windows 11 (22H2): Build 22621

Additional context

This bug is in 1.4.1 and 1.4.0 releases.

The only work arround I have found is to delay calling Invoke() so that it's not called from within the Execute() method. For example in the repro project:

    private void ExecuteMenuCommand()
    {
        DoWork();

        Task.Run(() =>
        {
            TestCommand.RaiseCanExecuteChanged();
        });
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Flyouts bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

2 participants