MenuFlyout doesn't respond to mouse (hover and click) on first open when running as RemoteApp over RDP
Describe the bug
When a WinUI3 application is running as a Remote Desktop RemoteApp, a MenuFlyout will not respond to mouse events (click and hover) the first time it is shown. Once the flyout has been hidden and shown again it behaves as expected.
Steps to reproduce the bug
- Compile the attached application and set it up as a RemoteApp on an instance of Windows Server.
- From another computer, run the RemoteApp over RDP
- https://learn.microsoft.com/en-us/azure/virtual-desktop/rdp-properties#remoteapp
- RDP file contains something like this:
redirectclipboard:i:1
redirectprinters:i:1
redirectcomports:i:0
redirectsmartcards:i:1
devicestoredirect:s:*
drivestoredirect:s:*
redirectdrives:i:1
session bpp:i:32
prompt for credentials on client:i:1
span monitors:i:1
use multimon:i:1
remoteapplicationmode:i:1
server port:i:3389
allow font smoothing:i:1
promptcredentialonce:i:0
videoplaybackmode:i:1
audiocapturemode:i:1
gatewayusagemethod:i:0
gatewayprofileusagemethod:i:1
gatewaycredentialssource:i:0
full address:s:TARGET.SERVER.HOST
alternate shell:s:||WinUIUnpackaged
remoteapplicationprogram:s:||WinUIUnpackaged
remoteapplicationname:s:WinUIUnpackaged
remoteapplicationcmdline:s:
workspace id:s:TARGET.SERVER.HOST
use redirection server name:i:1
- Click the button and mouse over the shown MenuFlyout. Notice that the items do not highlight on hover, and do not respond to clicks.
- Click outside the button to hide the flyout.
- Click the button again and mouse over the shown MenuFlyout. The items will now highlight when hovered, and add lines to the textblock when clicked. This is the expected behavior, however it should behave this way when shown the first time in step 4. WinUIUnpackaged.zip
Expected behavior
The expected behavior is that the MenuFlyout will respond to mouse hover and click every time it is shown, not just the second and later times.
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.7.0: 1.7.250310001
Windows version
Windows 11 (24H2): Build 26100
Additional context
The server hosting the RemoteApp is Windows Server 2019 Standard, version 1809, build 17763.7009
I've discovered this can be worked around by setting ShouldConstrainToRootBounds="True" on MenuFlyout. Unfortunately since MenuFlyout doesn't support Style there's no way to apply this to an entire app other than doing it manually everywhere, and making sure no one forgets it going forward, so we'll have to add a check to our CI process. But it's a sufficient workaround for now.
there's no way to apply this to an entire app other than doing it manually everywhere
Can you make a new MenuFlyout class and inherit from it? Not a solution but should be a better workaround.
@HO-COOH The trouble with that is it requires developers to know that they should use a custom class instead of the built-in one they're likely going to use out of habit. But I added a little CI check against our XAML to ensure the property gets set correctly, so it's sufficiently worked around for now.
Hi @garrettpauls, can you please confirm if the issue has been resolved?
@snigdha011997 This issue is still present in Microsoft.WindowsAppSDK 1.7.250606001