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. Thanks for all your past and future contributions.

Revision as of 08:59, 3 September 2013 by SB Dev (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Custom splash screen page for Windows Phone applications

From Wiki
Jump to: navigation, search

This article explains how to create a custom splash screen page for your Windows Phone application.

WP Metro Icon UI.png
SignpostIcon XAML 40.png
WP Metro Icon WP8.png
SignpostIcon WP7 70px.png
Article Metadata
Code ExampleTested with
SDK: Windows Phone 8
Devices(s): Windows Phone 8 Emulator
Platform(s): Windows Phone
Windows Phone 8
Windows Phone 7.5
Created: mehul_raje (02 Nov 2012)
Last edited: SB Dev (03 Sep 2013)



In most cases during the launch of an application, you need to do some background operations such as making a web request, parsing some data or something else and while doing this in the background it is necessary to keep the user engaged by showing a splash screen.
This article helps you to create a splash screen from a XAML page and display it as soon as your application launches, and show it until your background activity finishes. The advantage of this approach rather than the popup approach is that you can dynamically set start up or the next page depending on the result of your background activity.

Necessary steps

  1. First create a Windows phone Project in visual studio.
  2. Delete the default splash screen image from project.
  3. Your project already contains a MainPage.xaml file, keep it as it is. Add a new Page named SplashPage.xaml in the project, replace the existing xaml file code with the following code.
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Image Source="/splash.jpg" Stretch="Fill"/>

Make sure to set shell:SystemTray.IsVisible to False to use the full screen to display the image.

Modifying SplashPage.cs

Now, edit the SplashPage.cs file

  1. Handle the Loaded Event of SplashPage - SplashPage_Loaded, as shown below,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.IO;
namespace WindowsPhoneSample5
public partial class SplashPage : PhoneApplicationPage
private HttpWebRequest request;
public SplashPage()
Loaded += SplashPage_Loaded;
void SplashPage_Loaded(object sender, RoutedEventArgs e)
request = (HttpWebRequest)HttpWebRequest.Create(new Uri(""));
request.BeginGetResponse(new AsyncCallback(ReceiveResponseCallBack), null);
private void ReceiveResponseCallBack(IAsyncResult result)
HttpWebResponse response = (HttpWebResponse)this.request.EndGetResponse(result);
using (var stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string str = reader.ReadToEnd();
Deployment.Current.Dispatcher.BeginInvoke(() =>
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));

Please note that the SplashPage_Loaded function merely makes an asynchronous HTTP request, and that the ReceiveResponseCallBack is called when the HTTP request returns a response. Upon receiving a response, the user is navigated to MainPage.xaml. deployment.Current.Dispatcher.BeginInvoke is used to access the UI thread. Thus in the function, you may add code to perform any necessary background tasks while the splash screen is shown to the user.

Modifying MainPage.xaml.cs

From the SplashPage the user is navigated to the MainPage. Once the MainPage is loaded we should remove the entry of the SplashPage from the back stack. This is done so that the SplashScreen isn't considered as a page and the user doesn't navigate back to it by using the back key. To do this we need to modify the file MainPage.xaml.cs as follows.

namespace WindowsPhoneSample5
public partial class MainPage : PhoneApplicationPage
// Constructor
public MainPage()
Loaded += MainPage_Loaded;
void MainPage_Loaded(object sender, RoutedEventArgs e)


The last step is to add SplashPage.xaml in the Navigation Page tab of WMAppManifest.xml file. This is done so that the user is shown the splash screen when the application is launched.

Sample Code

Sample project demonstrated in this article is available for download here:


This article illustrated how you can develop a custom splash screen page for your Windows Phone application. There are other approaches to create a custom splash screen too, please refer to the see also section for related articles.

This page was last modified on 3 September 2013, at 08:59.
278 page views in the last 30 days.