HavenDV / H.NotifyIcon

TrayIcon for WPF/WinUI/Uno/MAUI
MIT License
563 stars 46 forks source link

Wrong background in tray context menu in win 10 #145

Closed m1adow closed 6 months ago

m1adow commented 8 months ago

Describe the bug

Hi! I'm using your library to add a tray functionality to my app. But I encountered a bug. On Windows 10, the tray context menu has a background color that differs from the window one. How do you think I could fix it?

Steps to reproduce the bug

  1. Set light theme in windows
  2. Set ContextMenuMode to SecondWindow
  3. Run the app
  4. Set a dark theme in the app
  5. Open the context tray menu

Expected behavior

Background colors are equal

Screenshots

image

NuGet package version

H.NotifyIcon.WinUI 2.0.124

Platform

WinUI

IDE

Visual Studio 2022

Windows Version

Windows 10

WindowsAppSDK Version

1.0

WindowsAppSDK Type

Packaged

Manifest

No response

Additional context

No response

HavenDV commented 8 months ago

Hi. Thank you for raising the issue. Since the development of this, a whole series of new versions of WindowsAppSdk have been released, and I think I need to fix this for the current version What is version of WindowsAppSDK you use now?

m1adow commented 8 months ago

1.5.240227000

Khiro95 commented 6 months ago

@HavenDV I found that setting bAlpha here to 0 makes the second window transparent, removing the unwanted background. Tested with WindowsAppSDK 1.5.240311000 https://github.com/HavenDV/H.NotifyIcon/blob/fb8aa2df73465a232a6f8cb7ebab3f28dea2e634/src/libs/H.NotifyIcon/Core/WindowUtilities.cs#L136-L161

HavenDV commented 6 months ago

@Khiro95 Very useful feedback, thank you very much, I'll commit it now. But you can also provide single line PR if you want

Khiro95 commented 6 months ago

@Khiro95 Very useful feedback, thank you very much, I'll commit it now. But you can also provide single line PR if you want

@HavenDV You are welcome. I will open a PR and let you review it.