Thursday, July 10, 2014

Using progress indicator in windows phone systemtray

I am going to add a progress bar to my existing phone app and found a good explanation at Microsoft's site.  It includes an example for implementing the progress bar programmatically or
declaratively.


Code Behind
using Microsoft.Phone.Shell;

namespace SystemTrayTest
{
    public partial class MainPage : PhoneApplicationPage
    {
        ProgressIndicator prog;

        public MainPage()
        {
            InitializeComponent();

            SystemTray.SetIsVisible(this, true);
            SystemTray.SetOpacity(this, 0.5);
            SystemTray.SetBackgroundColor(this, Colors.Purple);
            SystemTray.SetForegroundColor(this, Colors.Yellow);

            prog = new ProgressIndicator();
            prog.IsVisible = true;
            prog.IsIndeterminate = true;
            prog.Text = "Click me...";

            SystemTray.SetProgressIndicator(this, prog);
        }
    }
}


XAML
<shell:SystemTray.ProgressIndicator>
    <shell:ProgressIndicator IsIndeterminate="True" IsVisible="True" Text="Click me..." />
</shell:SystemTray.ProgressIndicator>

Source:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff626537(v=vs.105).aspx

No comments:

Post a Comment