Windows Phone Progress Indicator


You might find this useful. If you want a Windows Phone program to show that it is busy, maybe updating content from the network, binding data to a page or emptying a bank account then it turns out this is very easy. All you have to do is create a ProgressIndicator and bind it to the SystemTray.

ProgressIndicator prog; 
protected override void OnNavigatedTo(NavigationEventArgs e)
prog = new ProgressIndicator();
prog.IsIndeterminate = true;
prog.IsVisible = false;
prog.Text = "Leave me alone. I'm busy";
SystemTray.SetProgressIndicator(this, prog);

The code above makes the ProgressIndicator in the OnNavigatedTo method for the page, there are lots of other ways to do this. You can set the colour of the text and background of the display, but I use the default because I’m boring. If you set the IsIndeterminate property to true (as I have above) , this means that you don’t know how long the action will take. If you set this to false you can then use a SetValue method to adjust the size of the bar that is displayed.

Then, when your program is busy it just has to go:

prog.IsVisible = true;
This turns on the busy indicator. I’ve made a tiny demo application which uses two buttons to turn the indicator on and off. You can find it here.