System Tray ProgressIndicator in Windows Phone 7.5 / Mango phone


Windows Phone 7.5 (Mango) provides a Progress Indicator in the System Tray to show the progress of an async operation. 

ProgressIndicator in windows phone

The ProgressIndicator is a dependency object and can be data bound to the System Tray.

The ProgressIndicator class is defined as below:

windows phone ProgressIndicator
 
Using ProgressIndicator
 
To use a ProgressIndicator, you first need to add the namespace:

Progress Indicator
 
And then create it like below:

Progress Indicator in Mango phone
 
On the async operation status you can set visibility to false:

Mango phone Progress Indicator
 
Finally, you need to set it in the System Tray or Status Bar as below,

Progress Indicator
 
Putting it all together, the below listed source code will give you output as shown earlier in the post.
 
 
using System.Windows.Media;
 using
Microsoft.Phone.Controls;
 
using Microsoft.Phone.Shell;
 
namespace PhoneApp2
 {
     public partial class MainPage :
PhoneApplicationPage
 
    {
         public MainPage()
         {
             InitializeComponent();
             SystemTray.SetIsVisible(this, true);
             SystemTray.SetOpacity(this, 0.5);
             SystemTray.SetBackgroundColor(this, Colors.Black);
             SystemTray.SetForegroundColor(this, Colors.Blue);
             ProgressIndicator progressIndicator = new ProgressIndicator();
             progressIndicator.IsVisible = true;
             progressIndicator.IsIndeterminate = true;           
             progressIndicator.Text = "Hey I am Progress Indicator";        
             SystemTray.SetProgressIndicator(this, progressIndicator); 
         }
     }
 }
 

In this way you can use the System Tray Progress Indicator. I hope this post was useful. Thanks for reading