create a splash screen for windows phone app

0

To create a splash screen in windows phone with c# you need to create first a new Xaml page example (splash.xaml) and customize it what ever you like 

then  in the code of our page script (splash.xaml.cs)

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.Windows.Threading;
using System.Threading.Tasks;
namespace App_Facts.Assets
{
public partial class splash : PhoneApplicationPage
{
public splash()
{
InitializeComponent();
}protected async override void OnNavigatedTo(NavigationEventArgs e)
{
await Task.Delay(TimeSpan.FromSeconds(1));
NavigationService.Navigate(new Uri(“/MainPage.xaml“, UriKind.Relative));base.OnNavigatedTo(e);
}
}
}

in  MainPage.xaml.cs 

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 App_App.Resources;
namespace Birthday_Facts
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();} //When user press Back key
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
Application.Current.Terminate();
}

}
}

and that’s it don’t forget to change your start navigation page from manifest to splash.xaml

You might also like More from author