Search code examples
c#uwpmouse-cursor

How to use a Windows.UI.Xaml.Controls.Symbol as custom pointer in UWP


I'd like to use one of the build in symbols defined in Windows.UI.Xaml.Controls.Symbol enumeration as cursor like this:

Window.Current.CoreWindow.PointerCursor = 
    new CoreCursor(Windows.UI.Core.CoreCursorType.Custom, Symbol.TouchPointer);

But new CoreCursor constructor expects argument 2 to be uint and it doesn't work this way.


Solution

  • How to use a Windows.UI.Xaml.Controls.Symbol as custom pointer in UWP

    UWP does not support use Symbol as CoreCursor, if you want to use custom cursor, please use the CoreCursorType.Custom enumeration option, and specify the Id of the custom cursor. You can add a .res resource file that contains the custom cursor to your project and include it in your assembly with the /win32res compiler option. The Id is the Cursor Resource ID specified in the .res file.

    And here is the detail document about how to make Cursor Resource ID.