H.NotifyIcon
H.NotifyIcon copied to clipboard
Screen Scale changing
Describe the bug
When migrating from Laptop resolution (2140p display), to a 1080p display, the context menu of the notification icon area will appear in a scaled/wrong location on the display relative to the initial display resolution.
E.g, goes from being bottom right above taskbar on 2140p, to centre of the screen on the 1080p instead of rendering on the taskbar above the icon.
Steps to reproduce the bug
Run an instance of an application with h.notifyicon, context menu enabled. on a high res laptop, right click notification area and confirm context location. dock laptop to a lower res display right click notification area and the context menu will appear in a different location than expected behaviour
Expected behavior
Context menu for notification area should appear above the notification icon.
Screenshots
No response
NuGet package version
2.0.59
Platform
WPF
IDE
Visual Studio 2022
Windows Version
Windows 11
WindowsAppSDK Version
1.1
Additional context
No response
Thanks for the issue. Are you using a standard WinUI manifest like this?
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="App1.app"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- The combination of below two tags have the following effect:
1) Per-Monitor for >= Windows 10 Anniversary Update
2) System < Windows 10 Anniversary Update
-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>
</assembly>
Also please confirm that you are not using ContextMenuMode.SecondWindow.
If both statements are true, then I suspect that the problem is in the values that come from this event: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#nif_showtip-0x00000080
In this case, I will look for a stable replacement for the resulting values, which will take into account the current settings.
Thanks for the issue. Are you using a standard WinUI manifest like this?
<?xml version="1.0" encoding="utf-8"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity version="1.0.0.0" name="App1.app"/> <application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <!-- The combination of below two tags have the following effect: 1) Per-Monitor for >= Windows 10 Anniversary Update 2) System < Windows 10 Anniversary Update --> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware> <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness> </windowsSettings> </application> </assembly>
Also please confirm that you are not using ContextMenuMode.SecondWindow.
If both statements are true, then I suspect that the problem is in the values that come from this event: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#nif_showtip-0x00000080
In this case, I will look for a stable replacement for the resulting values, which will take into account the current settings.
I had the same problem, but with this manifest it works as expected. 🙂