Open spouliot opened 6 months ago
This is a problem on WinUI, which deprecated Window.Current. It will work fine on the uwp tree. To set the cursor on WinUi (and uno), use ProtectedCursor
, which I implemented recently.
The suggestion from @ramezgerges is correct solution. CoreWindow
will always be null
in Uno.WinUI
The issue was more a reminder to somehow [1] fix SampleApp than how to implement the new code for cursors (which already exists) 😄
[1] maybe just tell which the other test that covers the new code ? not sure how it's being handled for similar cases...
@spouliot there is a ProtectedCursor sample if I remember correctly.
Ah sorry, didn't realize ProtectedCursor
might not be working on macOS yet, reopened for now then
@ramezgerges yes, I know there is :)
@MartinZikmund no, it's implemented/working on macOS :)
However anyone trying SampleApp might not know which test to use for cursors (I did not the first time).
Having the old test fail makes it look like cursor support is broken or incomplete.
Maybe that old test should be #if
out when building for WinUI ?
Current behavior
Debug Output shows
At line 55 of
SetCursor.xaml.cs
the value ofMicrosoft.UI.Xaml.Window.Current.CoreWindow
isnull
which throws the `Expected behavior
No exception.
How to reproduce it (as minimally and precisely as possible)
SetCursor
pageThe cursor does not change (to the selected cursor name) and an exception is logged (see Debug Output).
Workaround
None.
Works on UWP/WinUI
None
Environment
No response
NuGet package version(s)
No response
Affected platforms
Skia (GTK on Linux/macOS/Windows)
IDE
No response
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
No response