Opening a ContextFlyout will display the cursor as a loading spinner or as a resize arrow
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 and the resize arrow
is random.
Steps to reproduce the bug
- Simply add a ComboBox with some items.
- Click on the ComboBox and wait.
- 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.
Thanks for reporting this. We have a fix for this issue for the WinAppSDK 1.5 timeframe.
@gegao18 1.5.1 was released but the issue is still there. Any updates?
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.
Also reproducible with right clicking in TextBox.
Still an issue one year later on 1.6.3.
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.
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
- Run the application.
- Move the mouse to the edge of the window, and the resize pointer will appear.
- Click on the
ComboBoxand keep the mouse still. - Right-click on the
Rectanglewithout 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.
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 |
|
|
| Top/down drag |
|
|
有事给我QQ留言 296567996
有事给我QQ留言 296567996
哈哈!你邮箱自动发email,Github自动把收到的email变成评论.
有事给我QQ留言 296567996
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);
}
}
}
1.8 released, still no fix.
有事给我QQ留言 296567996
Bump. Facing the issue still with the latest SDK.
有事给我QQ留言 296567996
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.