diff --git a/src/Uno.UWP/UI/Core/CoreWindow.Interop.wasm.cs b/src/Uno.UWP/UI/Core/CoreWindow.Interop.wasm.cs index 4485ea5ca2e9..2efc6d64d64d 100644 --- a/src/Uno.UWP/UI/Core/CoreWindow.Interop.wasm.cs +++ b/src/Uno.UWP/UI/Core/CoreWindow.Interop.wasm.cs @@ -7,7 +7,9 @@ internal partial class CoreWindow { internal static partial class NativeMethods { + [JSImport("globalThis.Uno.UI.WindowManager.current.setCursor")] + internal static partial void SetCursor(string type); } } } -#endif \ No newline at end of file +#endif diff --git a/src/Uno.UWP/UI/Core/CoreWindow.wasm.cs b/src/Uno.UWP/UI/Core/CoreWindow.wasm.cs index fba191034fd6..4b6181e5301c 100644 --- a/src/Uno.UWP/UI/Core/CoreWindow.wasm.cs +++ b/src/Uno.UWP/UI/Core/CoreWindow.wasm.cs @@ -23,6 +23,9 @@ public partial class CoreWindow private void Internal_SetPointerCursor() { +#if NET7_0_OR_GREATER + NativeMethods.SetCursor(_pointerCursor.Type.ToCssCursor()); +#else var command = string.Concat(new[] { "Uno.UI.WindowManager.current.setCursor(\"", @@ -31,6 +34,7 @@ private void Internal_SetPointerCursor() }); WebAssemblyRuntime.InvokeJS(command); +#endif } } }