Kiran BalijepalliToday's post is written by Kiran Balijepalli, a Microsoft Technical Evangelist for Windows Phone. He has more than 16 years of global technology leadership experience in desktop, web, cloud and mobile platforms. You can find all of Kiran's Microsoft Student blogs here, and he can be found on Twitter as @KiranKBee.

 

 

 Be sure to read my previous post, Part One: Design Style Programming & XAML in Windows Phone before moving on.

Open Visual Studio, File --> New Project --> Online --> Enter “phone XAML” in the search box on the top right corner.

Visual Studio

One of the greatest advantages of developing Windows Phone apps is templates. When you install the Windows Phone SDK it comes with default templates which you use to create your app. All the templates conform to the Windows Phone design guidelines and come with some starter code and design for you to get started. Another great advantage is that there are hundreds of different types of templates available online for you to choose the template that best matches your app design.

Visual Studio

Now select the Windows Phone XAML: Create Custom Live Tiles. Click on “Ok” to download and install the template.

Live Tiles

Once your installation is complete, you can see the .SLN loaded onto your Visual Studio IDE. Go ahead and hit F5 (choose to deploy either on a device or emulator).

The sample creates custom Live Tiles inside your Windows Phone app and runs as shown here. To understand the app description and other details go to Visual Studio Solution Explorer --> Solution Items --> Right click on description.html and select Open View in Browser. This will open the solution description which talks about the app and different types of Live Tiles.

Before we step into design style programming using XAML and visual studio, I will walk you through basics of your first Windows Phone game project using XNA4.0. Open Visual Studio File --> New Project --> Select as below and name your app “MyWPGame.”

XNA4

Click “OK.” The Visual Studio IDE creates MyWPGame solution for you directly. You’ll notice that unlike in any other Windows Phone project where you have to select the target Windows Phone OS (OS 7.1 or OS 8), here you have directly created the solution without selecting the WP OS platform. The point to note is in Visual Studio 2012 when you select XNA Game Studio 4.0 template you can only chose WP OS7.1 as the target Windows Phone OS. XNA Game Studio 4.0 apps that target Windows Phone OS 7.1 remain fully supported and continue to run on Windows Phone 8 devices.

XNA Game Studio 4.0 release has two profiles 1) “Reach” a feature set that exists on all platforms and 2) HiDef, an additional feature set which exists only on XBX and graphic card specific Windows. Discussing in depth about these two feature set is beyond the scope of this blog, but I would like to highlight some major namespaces and their features for a quick reference.

XNA Framework

Find more details on XNA Framework and Windows Phone 8 SDK development here.

clip_image011

Congrats! You can now run your first Windows Phone XNA game either on the listed emulators or on a device. Select the emulator from the dropdown menu and press F5 and ensure that the game runs on the target device or emulator.

Please note that Windows Phone 8 supports phones that have WVGA, WXGA, and 720p resolutions. This differs from Windows Phone OS 7.1.

Now let us step back and take a look at the default template with which you created your first Windows Phone game. Your myWPGame solution has two projects in the Solution Explorer 1) MyWPGame 2) MyWPGameContent (content).

The first project is where you write your game execution logic and the second project where you actually add references and resources pertaining to your game.

Now expand the MyWpGame project in the solution explorer, you will notice two .CS files Program.cs (ignore this class file as your target is windows phone), the second class file is Game1.cs. The default template gave you everything you need to create your first game project to get started.

Game1.cs is the file that is created for you is derived from Game class. Game1.cs has four important methods which initialize the game, loads content, updates state and then render it on the screen.

Learn Step-by step creation and download the sample here.

Explore more options on templates that are available to you in Visual Studio IDE. Remember that these templates are only for learning and exploration purposes, Do not simply clone or copy the templates into an App !! Remember your APP is your Mark !! in the next post I will discuss with you design style programming using Blend of Visual Studio 2012.

In my next post we will dig deeper into XAML design style programming.