Developing for Windows Phone 7

Posted on April 9, 2010 by

This entry is part 1 of 8 in the series Windows Phone 7

This is my first in a series of posts all about developing applications for Windows Phone 7 using Silverlight. After what I saw at the WPC and experienced at MIX10, I knew that I wanted to get involved in this as quickly, and as deeply as possible. I’m going to share with you my learning as I go through them, so that hopefully you can grow in experience along with me as you wait patiently for this Christmas when the WP7 devices will become available. My goal is to become an expert WP7 developer right in front of your very eyes!

Windows Phone

For those that don’t know, Microsoft announced recently the new Windows Phone platform – Windows Phone 7 Series (recently renamed to Windows Phone 7 and abbreviated by me in this blog as WP7). The development platform is split – as an option, or combined – to be Silverlight and XNA. Silverlight is a great general-purpose option for folks doing personal productivity applications, fun casual games, or just about anything. What’s great about them choosing Silverlight as a dev platform is that many people are already experienced with Silverlight or WPF, and making the transition to WP7 is a total snap. XNA is great for building high-quality 3D interactive games that will really knock people’s socks off on Windows, XBOX and now Windows Phone 7 Series.

In this kickoff post, I’m going to describe the process for getting your dev environment set up, and some additional learning resources for you to use as you follow along with me as we learn to build WP7 applications. In future posts we’ll tackle data access, MVVM, the application model, notification and sensor platforms, hub integration, security and more, so tune into my WP7 category feed for updates to this series and other interesting WP7 tidbits. For now, let’s get started by putting our environment together and making sure it works.

WP7 Learning Resources

Besides this blog, there are a number of great resources out there for learning about WP7. I’ve been assembling a list of those links on my delicious account at http://delicious.com/chriskoenig/wp7. As I find new and interesting things, I’ll keep that list updated, so you can check back there frequently, or subscribe to the feed directly at http://feeds.delicious.com/v2/rss/chriskoenig/wp7. I want to call out a couple as top-priorities on your list of places to get started:

  1. http://developer.windowsphone.com this is the central hub of information for WP7. You can download the tools here as well as get updates on information coming from the WP7 team
  2. Windows Phone Developer Blog – the official blog of the WP7 team
  3. @wp7dev – the official WP7 Twitter account
  4. WP7 Forums – these are the WP7 forums. Lots of great conversations going on there!

Beyond that, knowledge of Silverlight will be assumed. If you are not already an established Silverlight developer, you might want to take some time between this intro post and the next one to brush up on a couple of key Silverlight concepts including layout, data binding, styling and networking. There are plenty of tutorials out on http://silverlight.net for you to enjoy.

Setting up your Environment

Installing the software is really easy – the WP7 team has done a great job packaging things up into a single installer to make things simple. Here’s the link for the installer:

http://www.microsoft.com/downloads/details.aspx?FamilyID=2338b5d1-79d8-46af-b828-380b0f854203&displaylang=en

This one-stop-shop will install everything you need to get started with WP7 development. A couple of notes:

  • Installation of the tools does NOT require any previous version of VS2010, although it will integrate nicely with the RC if you already have that installed
  • The currently build of the WP7 dev tools (as of this writing) will not work with Visual Studio 2010 RTM. Stay with the RC until the tools are updated if you want to do WP7 development (for now).
  • You can not run the dev tools (specifically the Emulator) in a VM because of WP7 Emulator is actually a VM (more on that later). To do WP7 development, you’ll need to run the tools “on the metal”. You can run them in a Boot-to-VHD hosted partition, so that is an option for you as well.

Testing it Out

image

Once you have the tools installed, fire them up. You’ll notice the “Visual Studio 2010 Express for Windows Phone” icon in your start menu, so let ‘er rip. There are three project types – Windows Phone Application, Windows Phone List Application, and Windows Phone Class Library. The first is a clean, blank slate that works like most VS “File->New” project templates. Notice that the design surface is nice and big, and represents the entire device. When you press F5 to launch the debugger, you can see the Emulator kick in and display your application:

As I mentioned earlier, the emulator is actually more of a Virtual Machine than an emulator. Instead of pretending to be the WP7 OS, it runs the actual WP7 OS inside a VM. imageToday’s Emulator doesn’t support all of the WP7 OS features (location and accelerometer support is missing), but it does a good start at representing many of them including location, and orientation – we’ll dive into all of these features in future posts. For now, it looks like the emulator is up and running, and the application deployed as expected. If your emulator doesn’t start up correctly – don’t be alarmed. I have run into a few instances where various problems occur. Restarting the debugging session, or restarting the Emulator always fixes this problem, but I try really hard not to ever restart the Emulator if I don’t have to. It’s not so important now, but it will make a bigger difference once we get into more advanced topics like the Notification subsystem.

I realize that this was an incredibly rudimentary post, but in the interest of completeness, you have to start somewhere, and I almost always like to start at the beginning. Don’t be disheartened, those of you with higher expectations. In the next post, we’ll dive into retrieving and manipulating data, and exploring the navigation system. We’ll also talk about how the MVVM pattern can be applied to our application. Beyond that, we’ll start working with the notification and persistence bits, integrating with the various hubs and other OS level hooks, and more. Stay tuned; until next time!

Series NavigationWP7 Part 2 – Working with Data
  • Mike w

    Is there any way to get tools working in win XP.
    Its strange that VS2010 express can work on XP but the WP7 version doesn't.

  • http://chriskoenig.net Chris Koenig

    Hey Mike – there are no plans to support the WP7 dev tools on Windows XP as mainstream support for XP has already ended. I would recommend upgrading your machine to Windows 7 Ultimate and using Windows XP Mode (http://windows.microsoft.com/en-us/windows7/pro…) if you need backwards compatibility with Windows XP.

    /ck