I\'ve already done it quite easily in the past with Silverlight, by declaring a BusyIndicator as my root element, and binding the IsBusy property to the IsLoading property o
What I came up with:
Busy Indicator from the WPF Extended Toolkit:
In my base class view model, I've added the following method:
protected void ExecuteBackgroundProcess(Action action)
{
IsBusy = true;
Task task = Task.Factory.StartNew(() => action()).ContinueWith((s) => this.IsBusy = false);
}
When I want to load a collection from the server, I can call from a derived view model:
this.ExecuteBackgroundProcess(() =>
{
var collection = _securityRepo.TakeOfType(10).ToObservableCollection();
DispatcherHelper.CheckBeginInvokeOnUI(() =>
{
Securities = collection;
RaisePropertyChanged("Securities");
});
});
There's also a more robust & complete solution on CodeProject: http://www.codeproject.com/KB/WPF/ThreadingComponent.aspx?msg=3319891