WPF and Cursor

I was trying to figure out today the WPF’s equivalent to old WinForms functionality that allows a developer to change cursor shape.  For example, if you have a control that may take a second or two to load, you want to change cursor shape to hourglass (WaitCursor), then change it back once control has been loaded.

Turns out, this is just as easy in WPF, just not as intuitive.

Mouse.OverrideCursor = Cursors.Wait;

To change it back to default:

Mouse.OverrideCursor = null;

You will need to import a namespace:

using System.Windows.Input;

Leave a Reply

Your email address will not be published. Required fields are marked *