Found a very good solution on StackOverflow.
Comes down to implementing a small class, better put it somewhere in your WPF framework or Shared library.
Call it like this:
UIHelper.SetBusyState();
The cursor will return to normal when the application stops working.
Code:
using System;using System.Windows.Input;using System.Windows.Threading;namespace Global.Wpf
{publicstaticclassUIHelper
{privatestaticbool IsBusy;publicstaticvoid SetBusyState()
{
SetBusyState(true);
}privatestaticvoid SetBusyState(bool busy)
{if (busy != IsBusy)
{
IsBusy = busy;
Mouse.OverrideCursor = busy ? Cursors.Wait : null;if (IsBusy)
{newDispatcherTimer(TimeSpan.FromSeconds(0), DispatcherPriority.ApplicationIdle, dispatcherTimer_Tick, System.Windows.Application.Current.Dispatcher);
}
}
}privatestaticvoid dispatcherTimer_Tick(object sender, EventArgs e)
{var dispatcherTimer = sender asDispatcherTimer;if (dispatcherTimer != null)
{
SetBusyState(false);
dispatcherTimer.Stop();
}
}
}
}