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.

شاشة البداية في الويندوز فون

From Wiki
Jump to: navigation, search

يوضح هذا المقال كيفية إنشاء شاشة البداية مع شريط التقدم المتحرك في الويندوز فون .

WP Metro Icon UI.png
SignpostIcon XAML 40.png
SignpostIcon WP7 70px.png
Article Metadata
Code Example
Source file:
Tested with
Devices(s): WP7 Emulator
Platform(s): Windows Phone 7.5
Windows Phone 7.5
Keywords: Splash Screen/ Progress Bar
By bintk
Last edited: hamishwillee (03 Jul 2013)


شاشة البداية الافتراضية في ويندوز فون 7 التطبيق هو صورة ثابتة مع اسم splashscreenimage.jpg ومجموعة . يوضح هذا المقال كيف يمكنك استبدال هذه شاشة البداية بآخري - في هذه الحالة شاشة جديدة تحتوي على شريط التقدم متحرك.

The new splashscreen uses the Popup class to display content on top of existing content. To remove "flicker" our new splashscreen will use the same static splashscreen as a background, but overlay it with the animated progress bar. The BackgroundWorker class is used to run startup operations in a separate thread, and when complete it closes the Popup class.

شاشة البداية


First create a project with Windows Phone Application Template. Once the project is being created, create a Windows Phone User Control SplashScreenControl.xaml and add ProgressBar, TextBlock and Image in it. The image is the default splash of the project.

<Grid x:Name="LayoutRoot" Background="White" Width="480" Height="800">            
<ProgressBar HorizontalAlignment="Left" Margin="47,692,0,89" Name="progressBar1" Width="383" />
<Image Height="512" HorizontalAlignment="Left" Margin="0,0,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="480" Source="SplashScreenImage.jpg" />
<TextBlock HorizontalAlignment="Left" Margin="185,656,0,114" Name="textBlock1" Text="Please Wait..." Width="111" Foreground="Black" FontSize="22" />

In MainPage.xaml.cs constructor we called a function ShowSplash() to load the popup.

private void ShowSplash()
this.popup = new Popup();
this.popup.Child = new SplashScreenControl();
this.popup.IsOpen = true;

We initialize the Popup class and then set SplashScreenControl class to be hosted in the popup. IsOpen() opens the popup. Till now the code will load the splash screen (popup) with the progress bar.

Now we will add some background process, and when the background process gets completed we will close the popup as a result user will see the splash screen. Function StartLoadingData() starts and complete the background work.

private void StartLoadingData()
backroungWorker = new BackgroundWorker();
backroungWorker.DoWork += new DoWorkEventHandler(backroungWorker_DoWork);
backroungWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backroungWorker_RunWorkerCompleted);

First we initialize the BackgroundWorker class. We called RunWorkerAsync() function to starts execution of a background operation and thus backroungWorker_DoWork() is called.

void backroungWorker_DoWork(object sender, DoWorkEventArgs e)
//here we can load data

Here we use the Sleep() function to wait for some time. When backroungWorker_DoWork() gets expired, backroungWorker_RunWorkerCompleted() is called which closes the popup.

void backroungWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
this.Dispatcher.BeginInvoke(() =>
this.popup.IsOpen = false;

Thus user can see a splash screen with the progress bar.

To make a continuous progress bar we add the below code in SplashScreenControl.xaml.cs

this.progressBar1.IsIndeterminate = true;

الكود المصدري

الكود المصدري الكامل للتطبيق متاح للتحميل :

This page was last modified on 3 July 2013, at 03:52.
244 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.