Reputation: 12874
I want to show an Progress Circle, whenever my UI is loading something.
I tried using an boolean in the shellView and setting it true or false.
IsBusy=true;
But as I am using Caliburn Micro for MVVM, the View is not showing the Progress Circle, since the UI freezes on background work. I tried using Background worker, But not working.
I want to show an Progress Indicator when ever my View is busy. May be loading an ComboBox or doing some background task.
Upvotes: 0
Views: 1576
Reputation: 44048
If you're doing background tasks (such as retrieving data from Web Services), you can use BackgroundWorker
or Task.Factory.StartNew()
in .Net 4.0 to perform that operation in a separate thread (as opposed to doing it in the so-called "UI Thread"). This will allow your View to remain responsive while performing the background operations.
Now, in the case of loading the view itself, you cannot do that in a separate thread, and therefore there's no way to prevent the UI from freezing a little moment until its completely loaded.
So, an option is to create an "overlay window" in a separate thread (thus having its own dispatcher), which would be a transparent window placed right "above" (in Z-order) of the window currently loading. The overlay window remains responsive because it has its own dispatcher, so you can show the Loading indicator or animation, and remove it when loading is complete.
Here is an example of what I mean.
Upvotes: 4