Setting ProtectedCursor not working in RichEditBox
Describe the bug
The goal is to show a "hand" cursor when the user hovers over a link in my RichEditBox.
In UWP I was able to do this by subclassing RichEditBox and overriding OnPointerMoved
protected override void OnPointerMoved(PointerRoutedEventArgs e)
{
base.OnPointerMoved(e);
if (GetLinkAtPosition(e.GetCurrentPoint(this).Position) == null) { return; }
Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Hand, 1);
}
Steps to reproduce the bug
According to this answer, on WinUI3 I need to use ProtectedCursor. However, this code does not work, the "IBeam" cursor persists:
protected override void OnPointerMoved(PointerRoutedEventArgs e)
{
base.OnPointerMoved(e);
if (GetLinkAtPosition(e.GetCurrentPoint(this).Position) == null) { return; }
ProtectedCursor = InputSystemCursor.Create(InputSystemCursorShape.Hand);
}
Expected behavior
No response
Screenshots
No response
NuGet package version
Windows App SDK 1.8 Experimental 2: 1.8.250515001-experimental2
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 24H2 (22621, October 2024 Update)
IDE
Visual Studio 2022
Additional context
No response
Hi @tipa , can you help us by providing minimal repro project for further investigation?
@snigdha011997 sure, see here: test.zip Hope it helps
@snigdha011997 I provided a repro, why has the "needs-repro" tag been added?