Windows Phone Development: A Quick Introduction
This post is to help you get up to speed quickly with the Windows Phone 7 Series development announcements made today at MIX10.
The great news is that applications can be written for Windows Phone 7 Series devices using regular Silverlight (Silverlight 4 RC is now available) and XNA. No alternate or light versions here, so go ahead and leverage your existing experience.
New to Silverlight? Head to https://silverlight.net/learn, watch some videos, and try some hands-on labs. A similar story for XNA – head to the XNA getting started page.
In this post, I’ll focus on the Silverlight story (but those who know me realize I’ll cover the XNA view as well.)
Installing
Head to the Windows Phone for Developers page and download the developer tools (be sure to review the release notes as well).
The installer will take care of installing the free Visual Studio 2010 Express RC (it will update an existing install of an RC version), XNA Game Studio 4.0 CTP, Silverlight 4 SDK and Tools for Visual Studio 2010, etc.
You can also create applications using Expression Blend 4 Beta as detailed in this post.
A (Very) Basic Application
Let’s keep things simple with this first application. Start Visual Studio 2010 (Express or another RC version):
Click “New Project…”
Windows Phone Application is a basic template, and Windows Phone List Application is helpful if you’ll be using the List and Navigation controls.
You can also create an XNA based game. Click on the XNA Game Studio 4.0 tab and choose Windows Phone Game (4.0) . I plan to cover this in a future post.
Choose Windows Phone Application:
By default, you’ll see a split view with design and XAML surfaces. You can make changes in either. From the Toolbox, add a TextBox and Button, dragging/resizing to fit:
Double-click the button, then in the generated button1_Click event in the code behind file, add code to update the list title:
Now run it! (Run Button (F5), or Debug –> Start Debugging). The Windows Phone Emulator will start (left image) then load your application (middle image). Enter your name and click Button (right image):
Congratulations, you have a Windows Phone 7 Series application! Sure, not a very interesting application, but I’m sure you’ll do much better.
Debugging
Debugging is basically the same story that you’re used to with other Visual Studio applications. Set breakpoints (F9) and they’ll be hit when you use the application:
Simple enough. Step through, view locals, change values, add DataTips, etc.
Windows Phone Emulator
The Windows Phone Emulator lets you develop applications without a device and supports GPS simulation, rotation/orientation, skinning, GPU emulation, and more.
The emulator is default, but if you manage to track down a device, you can change this via the dropdown:
Note that you can modify the emulator with a few options. They are, in order:
- Close (see next)
- Minimize
- Rotate counterclockwise
- Rotate clockwise
- Zoom / Reset Zoom
- Settings (zoom from custom % to fit to screen)
Rotating the emulator shows how your application will look when the orientation (accessible via Page.SupportedOrientations) changes:
You might close the emulator, and you’ll get a dialog:
If you’re planning to change code and rerun the application several times, it’s faster to leave the emulator openand instead stop the application through Visual Studio. This way the emulator won’t need to load and initialize each time.
Learning More
Your first application done, it’s time to learn more:
- Course - I’m a fan of the learning courses at the Channel 9 Learning Center, and there’s a new Windows Phone 7 Series Developer Training Kit covering Silverlight and XNA
- Article - For an overview of the developer story, read Getting Started Guide for Developing for Windows Phone
- Article - Windows Phone 7 Application Platform Overview
- Videos - There are already four Windows Phone videos available at Silverlight.net
- Code - There are samples on MSDN, including Mini-Browser, Application Bar, Location Service, and Accelerometer.
- Blog - Windows Phone Developer
- Blog – Charlie Kindel
- Book - There’s a free draft preview download of Charles Petzold’s eBook “Programming Windows Phone 7 Series”
- Reference - Windows Phone Class Library Reference
Enjoy creating those applications!
-Chris
Comments
- Anonymous
March 19, 2010
At MIX, many people discovered that the PDC Laptop was great for WP7 development. Hopefully Acer starts selling them in the US soon so the rest of us can get one.