none
[UWP]How do i hide the mouse cursor? RRS feed

Answers

  • My application uses SharpDX (DirectX) to render to a SwapChainPanel in xaml. I have tried both of these (which I presume point to the same object):

    // hide mouse cursorWindows.UI.Core.CoreWindow.GetForCurrentThread().PointerCursor = null;Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = null;

    putting them in the App.OnLaunched() method. I've also tried putting them in MainPage constructor.

    I'm using CoreIndependentInputSource, that is something that jumps out at me as a possible culprit.

    Edit :

    Yes, it seems the cursor graphic must also be set on the background thread. I incorrectly assumed that all rending was being performed on the main-thread, including the mouse cursor. As I haven't yet implemented back-threaded or multithreaded rendering. Perhaps the cursor is a special case because of the input being handled an another thread. So the following worked:

    // Create the source on the background thread

    coreInput = xamlSwapChainPanel.CreateCoreIndependentInputSource(CoreInputDeviceTypes.Mouse);

    coreInput.PointerCursor = null;




    Monday, August 3, 2015 8:16 AM

All replies

  • Is your application a XAML app? In a DirectX app, setting CoreWindow's PointerCursor property to null does in fact hide it.

    Monday, August 3, 2015 6:24 AM
  • My application uses SharpDX (DirectX) to render to a SwapChainPanel in xaml. I have tried both of these (which I presume point to the same object):

    // hide mouse cursorWindows.UI.Core.CoreWindow.GetForCurrentThread().PointerCursor = null;Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = null;

    putting them in the App.OnLaunched() method. I've also tried putting them in MainPage constructor.

    I'm using CoreIndependentInputSource, that is something that jumps out at me as a possible culprit.

    Edit :

    Yes, it seems the cursor graphic must also be set on the background thread. I incorrectly assumed that all rending was being performed on the main-thread, including the mouse cursor. As I haven't yet implemented back-threaded or multithreaded rendering. Perhaps the cursor is a special case because of the input being handled an another thread. So the following worked:

    // Create the source on the background thread

    coreInput = xamlSwapChainPanel.CreateCoreIndependentInputSource(CoreInputDeviceTypes.Mouse);

    coreInput.PointerCursor = null;




    Monday, August 3, 2015 8:16 AM