CoreCursor CoreCursor CoreCursor CoreCursor Class


Defines a cursor (visual pointer) object.

public : sealed class CoreCursor : ICoreCursor
struct winrt::Windows::UI::Core::CoreCursor : ICoreCursor
public sealed class CoreCursor : ICoreCursor
Public NotInheritable Class CoreCursor Implements ICoreCursor
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


This example shows how to set a "hand" cursor when the pointer is over a button.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Button Content="Button 1"
public sealed partial class MainPage : Page
    CoreCursor buttonCursor = null;
    CoreCursor cursorBeforePointerEntered = null;

    public MainPage()
        buttonCursor = new CoreCursor(CoreCursorType.Hand, 0);

    private void Button_PointerEntered(object sender, PointerRoutedEventArgs e)
        // Cache the cursor set before pointer enter on button.
        cursorBeforePointerEntered = Window.Current.CoreWindow.PointerCursor;
        // Set button cursor.
        Window.Current.CoreWindow.PointerCursor = buttonCursor;

    private void Button_PointerExited(object sender, PointerRoutedEventArgs e)
        // Change the cursor back.
        Window.Current.CoreWindow.PointerCursor = cursorBeforePointerEntered;


To create a CoreCursor instance using a pre-defined Windows cursor, use any of the cursor types available in the CoreCursorType enumeration other than Custom. In this case, the Id property is ignored.

To use a custom cursor, 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.


CoreCursor(CoreCursorType, UInt32) CoreCursor(CoreCursorType, UInt32) CoreCursor(CoreCursorType, UInt32) CoreCursor(CoreCursorType, UInt32)

Creates a new CoreCursor instance of the provided cursor type.

public : CoreCursor(CoreCursorType type, unsigned int id)
CoreCursor(CoreCursorType type, uint32_t id) const;
public CoreCursor(CoreCursorType type, UInt32 id)
Public Sub New(type As CoreCursorType, id As UInt32)
CoreCursorType CoreCursorType

The type of the new cursor.

UInt32 UInt32

The unique resource ID of the new cursor.


Id Id Id Id

Gets the resource ID of the cursor.

public : unsigned int Id { get; }
uint32_t Id();
public uint Id { get; }
Public ReadOnly Property Id As uint
uint uint

The ID of the cursor.

Type Type Type Type

Gets the type of the cursor.

public : CoreCursorType Type { get; }
CoreCursorType Type();
public CoreCursorType Type { get; }
Public ReadOnly Property Type As CoreCursorType
CoreCursorType CoreCursorType

The type of the cursor.