Вы находитесь на странице: 1из 9

Simple Interesting Hello World With Windows Phone 7

Windows Phone 7
Simple Interesting Hello World
By : Yoza Wiratama

Objective :
1. Create simple hello world with click event in application bar button 1. Visual Studio and Windows Phone SDK 2. Create Textbox using XAML Code 3. Application Bar with XAML Code and Click Trigger 2. Use List<> in windows phone

Visual Studio and Windows Phone SDK


1. Open Visual Studio Open Your Visual Studio and you will see the start page first :

Solution Explorer

2. Click New Project Click New Project and select Silverlight for Windows Phone in Installed Templates for Visual C#. After That select Windows Phone Application, Change your project name : Hello World, or you can change with according what you want. Then Click OK

By Yoza Wiratama | yozawiratama.net

Simple Interesting Hello World With Windows Phone 7

New Project

3. Target OS Version Select Windows Phone OS 7.0 for the version, then click OK

OS Version

4. Solution Explorer In this solution explorer you can see all your document for the project you create. 2 By Yoza Wiratama | yozawiratama.net

Simple Interesting Hello World With Windows Phone 7

5. Change Page Title Double Click in MainPage.xaml in Solution explorer and you will open MainPage.xaml.

MainPage.xaml

On design view click on text page name and code view directliy focus in :
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>

By Yoza Wiratama | yozawiratama.net

Simple Interesting Hello World With Windows Phone 7

Change page name in textblock

Change text in Text="page name" page name to be Text="Hello World!"

Change to be Hello World! In textblock

6. Insert Image In solution explorer, right click on Hello World select add , then New Folder change name to be Images. And also right click on Images Folder, add, then Existing File Or you can Shift + Alt + A. Open File window will open, and open : C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Icons\dark Add three icon : 1. appbar.back.rest.png 2. appbar.check.rest.png 3. appbar.next.rest.png Then add. Select three of that image using Hold shift + Click, look at properties. In Build Action change to Content.

By Yoza Wiratama | yozawiratama.net

Simple Interesting Hello World With Windows Phone 7

Insert Images

7. XAML Code In xaml code write this code :

By Yoza Wiratama | yozawiratama.net

Simple Interesting Hello World With Windows Phone 7

MainPage.xaml

8. C# Code Right Click in xaml and select View Code, and you will open MainPage.xaml.cs

MainPage.xaml.cs

9. Run project with F5

By Yoza Wiratama | yozawiratama.net

Simple Interesting Hello World With Windows Phone 7

By Yoza Wiratama | yozawiratama.net

Simple Interesting Hello World With Windows Phone 7

Use List<> in windows phone


1. XAML Code Update your ApplicationBar xaml code :

2. C# Code 1. Add List<> in class and can access for all method :

By Yoza Wiratama | yozawiratama.net

Simple Interesting Hello World With Windows Phone 7

2. ApplicationBarButton Event :

3. Run Project with F5, you can click next, check and back button.

By Yoza Wiratama | yozawiratama.net

Вам также может понравиться