Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to create a modal wait screen with spinner on Windows Phone

From Wiki
Jump to: navigation, search

This article explains how to how to show customized progress bar or wait screen in Windows Phone by overlaying a semi-transparent screen with an animated spinner.

WP Metro Icon UI.png
SignpostIcon XAML 40.png
WP Metro Icon WP8.png
SignpostIcon WP7 70px.png
Article Metadata
Code ExampleCompatibilityArticle
Created: munjalrohit (16 Sep 2013)
Last edited: hamishwillee (15 Oct 2013)


Apps on occasion need to wait for an activity to complete, for example getting a response from Web service. Windows Phone provides a default ProgressBar class which is useful in many cases.

This article explains how to create a customised wait screen using a spinner. The screen is implemented as a semi-transparent page with an animated spinner. If it is necessary that the UI can take other input while the wait screen is displayed, this approach would not be suitable.


The implementation is provided by overlaying the screen with a grid (that displays an animated spinner). The grid is initially collapsed, has an opacity of 60%, and a Z-index greater than the rest of the page definition. When it is expanded its Z order means that it overlays the main screen, and its opacity means that the underlying "main screen" appears disabled (and is, since all events go to the overlaying grid).

Below is the code for the WaitGrid:

<Grid x:Name="Waitgrid" Grid.Row="0" Visibility="Collapsed"  Grid.RowSpan="2" Background="Black" Opacity="0.6">
<Ellipse Fill="{StaticResource PhoneForegroundBrush}" Height="50" Width="50" Canvas.ZIndex="100" Margin="10,10">
<ImageBrush ImageSource="/Images/Spinner.png" Stretch="Uniform"/>
<RotateTransform x:Name="SpinningRotateTransform"
CenterY="25" />

The animation for moving spinner image is shown in the code snippet below

<Storyboard x:Name="SpinningAnimation">
<DoubleAnimation AutoReverse="False"
To="360" />

For this example I use a timer with a 5 second delay. The same approach can be used for waiting for a response from Web service.

The code below shows the timer controlling the grid visibility.

public partial class MainPage : PhoneApplicationPage
DispatcherTimer timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };
DateTime PStartTime = DateTime.MinValue;
// Constructor
public MainPage()
// Sample code to localize the ApplicationBar
private void btnLogin_Tap(object sender, System.Windows.Input.GestureEventArgs e)
//Write here code for displaying till the result not come from Web service.
Waitgrid.Visibility = Visibility.Visible;
timer.Tick += timer_Tick;
void timer_Tick(object sender, EventArgs e)
Waitgrid.Visibility = Visibility.Collapsed;

The full code can be found in the sample code here:

This page was last modified on 15 October 2013, at 06:29.
215 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.