microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Opening a ContextFlyout will display the cursor as a loading spinner or as a resize arrow

Open bogdan-patraucean opened this issue 2 years ago • 17 comments

Describe the bug

Whenever you click a ComboBox to display its items, the cursor will change from pointer to a loading spinner or a resize arrow. Once you move the cursor or the focus is lost, it reverts to it's default pointer state.

It seems like the switch between the loading spinner image and the resize arrow image is random.

Steps to reproduce the bug

  1. Simply add a ComboBox with some items.
  2. Click on the ComboBox and wait.
  3. Observe how the cursor is changing.

Expected behavior

I would expect that the cursor remains unchanged, whenever I open any ComboBox. No loading spinner or resize arrow should be displayed.

Screenshots

Can't make a screenshot because it looses the focus and the state reverts back to the default pointer.

NuGet package version

WinUI 3 - Windows App SDK 1.8.3

Windows version

No response

Additional context

This did not happen before 1.4.

⚠️Seems like using a MenuFlyout as a ContextFlyout triggers the same issue.

bogdan-patraucean avatar Sep 04 '23 18:09 bogdan-patraucean

Thanks for reporting this. We have a fix for this issue for the WinAppSDK 1.5 timeframe.

gegao18 avatar Nov 28 '23 22:11 gegao18

@gegao18 1.5.1 was released but the issue is still there. Any updates?

bogdan-patraucean avatar Mar 13 '24 21:03 bogdan-patraucean

I repro this on the ComboBox samples in WinUI 3 Gallery. It didn't initially repro for me, so it is maybe a little better than it used to be, but the problem is consistent for me now that it has started.

codendone avatar Mar 14 '24 04:03 codendone

Also reproducible with right clicking in TextBox.

HO-COOH avatar Mar 27 '24 18:03 HO-COOH

Still an issue one year later on 1.6.3.

bogdan-patraucean avatar Feb 07 '25 22:02 bogdan-patraucean

I still have the same issue as well. In addition, when I try to set the pointer after the user selected and item (using SelectionChanged event) the pointer will not change. No matter what Task/DispatchQueue/Delay I try. It might be unrelated, but it works without a problem when executed from a button click event.

semiroot avatar Feb 21 '25 16:02 semiroot

Has this bug still not been fixed? I'm using the latest version 1.71 of the SDK, and this issue still persists!

   <StackPanel Spacing="10">
       <ComboBox>
           <ComboBoxItem Content="hi" />
       </ComboBox>
       <Rectangle Width="100" Height="100">
           <Rectangle.ContextFlyout>
               <MenuFlyout>
                   <MenuFlyoutItem Text="Change color" />
               </MenuFlyout>
           </Rectangle.ContextFlyout>
           <Rectangle.Fill>
               <SolidColorBrush x:Name="rectangleFill" Color="Red" />
           </Rectangle.Fill>
       </Rectangle>
   </StackPanel>

Bug Reproduction Steps

  1. Run the application.
  2. Move the mouse to the edge of the window, and the resize pointer will appear.
  3. Click on the ComboBox and keep the mouse still.
  4. Right-click on the Rectangle without moving the mouse.

Patterns I've Found

  • The pointer will be incorrectly displayed only when the mouse remains in the same position. It will refresh to the normal pointer after being moved.
  • The incorrect pointer will change according to the previous pointer state. For example, if you move the mouse to the lower right corner of the window (and the resize pointer is shown), the pointer will turn into a 45-degree resize pointer.

NiuYuXiaoSir avatar Apr 19 '25 09:04 NiuYuXiaoSir

The incorrect pointer will change according to the previous pointer state. For example, if you move the mouse to the lower right corner of the window (and the resize pointer is shown), the pointer will turn into a 45-degree resize pointer.

I can confirm this, except if top down is the last cursor triggered.

Action Window edge Context Menu
Left/right drag
Corner drag

Image

Image

Top/down drag

Image

Image

AlexanderBlackman avatar May 07 '25 09:05 AlexanderBlackman

有事给我QQ留言 296567996

NiuYuXiaoSir avatar May 07 '25 09:05 NiuYuXiaoSir

有事给我QQ留言 296567996

哈哈!你邮箱自动发email,Github自动把收到的email变成评论.

AlexanderBlackman avatar May 07 '25 09:05 AlexanderBlackman

有事给我QQ留言 296567996

NiuYuXiaoSir avatar Jul 19 '25 14:07 NiuYuXiaoSir

This issue seems to be fixed by this code:

[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SetCursor(IntPtr hCursor);
const int IDC_ARROW = 32512;
private static IntPtr arrowCursor = IntPtr.Zero;

public MainWindow()
{
 if (arrowCursor == IntPtr.Zero)
 {
  arrowCursor = LoadCursor(IntPtr.Zero, IDC_ARROW);
 }
}

private void ComboBox_DropDownOpened(object sender, object e)
{
 if (arrowCursor != IntPtr.Zero)
 {
  SetCursor(arrowCursor);
 }
}

private void ComboBox_PointerEntered(object sender, PointerRoutedEventArgs e)
{
 if (sender is ComboBox comboBox && !comboBox.IsDropDownOpen)
 {
  if (arrowCursor != IntPtr.Zero)
  {
   SetCursor(arrowCursor);
  }
 }
}

0x000013 avatar Jul 19 '25 14:07 0x000013

1.8 released, still no fix.

bogdan-patraucean avatar Sep 29 '25 14:09 bogdan-patraucean

有事给我QQ留言 296567996

NiuYuXiaoSir avatar Sep 29 '25 14:09 NiuYuXiaoSir

Bump. Facing the issue still with the latest SDK.

abdes avatar Oct 13 '25 16:10 abdes

有事给我QQ留言 296567996

NiuYuXiaoSir avatar Oct 13 '25 16:10 NiuYuXiaoSir

I blocked that mf so it does not spam anymore. Any updates on the issue? We now pave the way to SDK 2.0, it would be great if these kind of issues would be fixed, it's a bare minimum.

bogdan-patraucean avatar Oct 13 '25 20:10 bogdan-patraucean