Displaying the progress bar in WP8

by CameronM 4. February 2013 20:04

One of the really nice additions to the Windows Phone 8 SDK is the ProgressBar. This control, which displays the ‘loading’ dots in your app is such as common part of the Windows Phone OS that it was a surprise that in WP7 it wasn’t provided to developers out of the box.

This has changed in WP8 and showing the progress bar is a painless experience, but one that will immeasurably assist in the useability of you app.

The code below shows how you could display the progress bar while you wait for an asynchronous function to complete.

private async void btn_continue_Click(object sender, RoutedEventArgs e)
            // show progress bar
            SystemTray.ProgressIndicator = new ProgressIndicator();
            SystemTray.ProgressIndicator.IsIndeterminate = true;
            SystemTray.ProgressIndicator.IsVisible = true;
            // call some long-running process
            await ...;
            SystemTray.ProgressIndicator.IsVisible = false;

Tags: ,

Windows Phone 8 | WP8