So you want to develop for Windows Phone 7?
So you want to develop for Windows Phone 7?
Join the DZone community and get the full member experience.Join For Free
You’ve probably read quite a lot of articles on the new mobile operating system (and the devices for it) from Microsoft – Windows Phone 7. Yesterday, some of the Microsoft employees already received the devices on their hands and Tim Heuer (Product Manager for Silverlight at Microsoft) broadcasted the unboxing experience via a live stream, while Scott Hansleman (Principal Program Manager at Microsoft) wrote a detailed review on the phone. And you might have wondered – what is needed to start development for this platform?
Currently, the development tools provided by Microsoft are in the Beta stage and are available at no cost. The development is only .NET-based, therefore knowledge of the .NET platform is required. The two supported sub-frameworks are XNA and Silverlight and the base language is C# (although I believe soon enough we'll see the tools working with other languages as well).
What’s inside the box?
The development toolkit contains the following components:
• Microsoft Visual Studio 2010 (Express, in case you don’t have a commercial edition installed)
• XNA Game Studio 4.0 Beta
• Silverlight Tools
• Microsoft Expression Blend 4 for Windows Phone Beta
• Windows Phone 7 emulation software
The all-in-one package can be downloaded here in two formats – if you have a fast Internet connection and are not located behind a tight proxy, you can use the web installer. It will automatically detect existing tools and will download the necessary components (that are not yet installed). If that is not the case, an ISO image can be downloaded from the same location (currently its size is 429.5MB). Generally, the installation will take around 20 minutes, depending on the machine software and hardware configuration.
NOTE: Before installing the Beta release of Windows Phone 7 development tools, you must remove the CTP release, if that was installed. Failing to do so might result in a non-working installation and specific component compatibility problems.
Please note, that there are specific requirements to be met for the developer machine in order to run the set of developer tools. These include:
• OS: Windows 7 or Windows Vista
• Free disk space: 3GB
• RAM: 2 GB
• Graphics card: DirectX 10 capable with a WDDM 1.1 driver
Dev tools installed. What next?
NOTE: The development tools available at the moment are in their Beta development stage. Therefore, it is not guaranteed that those are completely bug-free and sometimes might not work as expected. Any found bugs should be reported to Microsoft.
Once you installed the development tools, when you will launch Visual Studio you will see additional project types listed in the C# category – there will be Silverlight for Windows Phone, where you will be able to create Silverlight-based applications:
And there are also new project types in the XNA Game Studio 4.0 section (mind that XNA 4.0 is also in its Beta development stage):
The same project types are not available by default for other languages (in the New Project dialog) at this moment.
Here is what you can build with existing tools (based on the available project types):
Silverlight Windows Phone Application
This is the most common type of applications that you will probably be working with. By default, you get a blank page with your application title and a frame where you are able to insert various controls, limited by the SDK subset.
As with any other application developed for Windows Phone 7 using the development toolkit, you will be able to either debug the application on a Windows Phone 7 device (which is unlikely at the time of this article being published, unless you are a Microsoft employee) or in the emulator.
Running inside the emulator provides the same feature subset for your application as if it runs on an actual device, minus the hardware. The controls might be a bit unusual (for example, the default PC keyboard is not recognized by the emulator and you will have to test typing while clicking on the virtual keyboard with the mouse).
Silverlight Windows Phone List Application
By its nature, a list application is in no way different from a simple Windows Phone 7 application – it uses the same subset of tools and features. However, its functionality is based around a main list of possible actions, displayed as the main application page.
Consider the list as the main menu, where the user can select what he/she wants to do. Once clicked on a list item, a new page will be opened that corresponds to that specific list item. As an example of an application that might take advantage of this feature would be an email client, where on the main page the user is able to choose what he wants to do – view the inbox, compose a letter or review the sent messages.
Silverlight Windows Phone Class Library
This project type is used for applications that depend on external library functionality. For example, if you would like to make a part of your application extensible and depend on specific modules rather than have functions hardcoded, then this is the way to go.
Windows Phone Game
If you ever worked with XNA Game Studio, then you won't be surprised see a familiar environment. Unlike Silverlight projects, an XNA project doesn’t have a visual designer (which I wouldn’t recommend using anyway, unless you absolutely have to), but at the same time it kept the original XNA game structures, like the LoadContent, Update and Draw methods.
Windows Phone Game Library
Same as with the Silverlight Windows Phone Class Library, a game library is used to provide a modular architecture to a Windows Phone 7 game, where the main unit is dependent on several libraries that can be used as extensions for the base functionality.
These are the project types currently available to developers who indend to write software for the new mobile operating system.
One more tool that's worth mentioning is Expression Blend 4 for Windows Phone. It allows developing the same application types as in Visual Studio:
NOTE: Windows Phone Databound Application is the same application type as Silverlight Windows Phone List Application. I am still not sure why there is no single naming convention on application types.
Expression Blend makes it a bit easier to work with various transitions and animations, however I would highly recommend working directly with XAML markup instead of realying on a visual designer. This will help you avoid "spaghetti" layout markup code that eventually must be modified or extended. If you are interested in the arguments behind this advice, you can read what Charles Petzold had to say about visual design tools in one of his recent blog posts.
With all the above being said, you are ready to start developing Windows Phone 7 applications. Deploying them to the masses is not a free thing and if you want your apps to appear in the App Marketplace, you will have to get a $99/year developer subscription.
To get more information on general development, as well as to read speicific guidelines, visit the official Windows Phone 7 Developers page.
PS: When installing the set of development tools, the installation ended successfully, however the emulator failed to start. If that is the case for you, take a look at this thread - it covers most of the possible issue (although mine wasn't on the list). My problem was that I uninstalled the CTP set but the emulator somehow remained untouched. Therefore, the new installation skipped installing the new emulator. When I reached the debugging stage, the emulator greeted me with an error message. The solution was to manually uninstall the emulator (via Control Panel) and then repairing the Windows Phone 7 Developer Tools installation by launching the web installer once again.
Opinions expressed by DZone contributors are their own.