For a view constructed using WPF, I want to change the mouse cursor to a hourglass when the application is busy and nonresponsive.
One solution is to add
I am simply doing
Mouse.OverrideCursor = Cursors.Wait;
try {
// Long lasting stuff ...
} finally {
Mouse.OverrideCursor = null;
}
According to the documentation of Mouse.OverrideCursor Property
To clear the override Cursor, set OverrideCursor to null.
The try-finally statement ensures that the default cursor is restored in any case, even when an exception occurs or the try-part is left with return or break (if inside a loop).