Take the 2-minute tour ×

How can I hide the cursor in a WPF window that is fully transparent (alpha=0).

I tried the usual

this.Cursor = System.Windows.Input.Cursors.None;

and it works on areas with content where alpha > 0 but when the cursor moves to an area - in the same window - where the background is fully transparent the cursor re-appears.

I also added System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.None; but that didn't help.

I realize that setting the alpha of background to 1 might be a solution but for various reasons this creates other problems...

share|improve this question
I suggest to show your xaml. –  Erez Feb 23 '11 at 14:24
There is no XAML. The WPF window is created programmatically (within a WinForm app). Just assume an empty WPF window with a background color where all 4 components are 0. Now try to hide the cursor. That is the core issue. It has to do with WPF hit-testing. Pixels with alpha=0 are treated as not belonging to the window. –  Harald Feb 23 '11 at 22:31

1 Answer 1

Maybe as a work-around you can create a tiny non-transparent area somewhere, and move the mouse there just before hiding it:

// Coordinates of your non-transparent area:
var x = 10;
var y = 10;
System.Windows.Forms.Cursor.Position = new System.Drawing.Point(x, y);
this.Cursor = System.Windows.Input.Cursors.None;
share|improve this answer

Your Answer


