Articles in categories

Articles

Change cursor in WPF

Ever need to change the cursor in your WPF application? E.g. when your application is doing something and you need to show a wait cursor instead of the arrow. It's pretty easy, here's how to do it:

try
{
  Mouse.OverrideCursor = Cursors.Wait;

  // Your logic here

  Mouse.OverrideCursor = Cursors.Arrow;
}
catch (Exception ex)
{
  Mouse.OverrideCursor = Cursors.Arrow;

// Handle Exception }

You don't need to use the Try-Catch block. It's just to show that in case of an error you need to reset the cursor to the arrow.
Intellisense will show you which cursors you can use.

Cursor

More information about the WPF Cursor Class can be found on MSDN: Cursor Class