On my first post of the 31 Days of Windows Phone, we need to set some expectations.
First, I’m assuming you are somewhat knowledgeable about Silverlight. I did a 31 Days of Silverlight series last year, so I’d recommend starting there if you’ve never used Silverlight before. ALL of the articles in this series will assume some basic knowledge about Silverlight.
Second, I’m assuming you’ve got all of the tools installed. To get them, you just need to head over to http://create.msdn.com and download them. You’ll get Visual Studio 2010 for Windows Phone, as well as Expression Blend 4 for Windows Phone. You’ll definitely need both of them, and they’re both completely free. If you already have official versions of that software, it will just update the project templates instead of adding new software to your machine.
OK, on to the content!
Today, we’re going to take a look at the default Windows Phone project template you generally will start with in Visual Studio 2010: Windows Phone Application.
Here’s a look at the Solution Explorer for a default project. I’m not going to provide the full contents of each file here, instead I’m just going to address the purpose of each. If you want to see the contents, install the tools and give this a try! It’s so freakin’ easy! (I’ve also included a downloadable project file at the end of this article, if you’re feeling lazy.)
Replace this image with the one you want to represent your application on the phone. This is what the users will see when they see your application on their phone. Make it count.
Think of this much like an ASP.NET web.config file. It is where you keep universal data and settings for your entire application. I also prefer to keep my style data in this file as well, but it’s not required to do so.
The code-behind for the previous file, this is where you will handle “tombstoning” your application. We will be covering the concept of multi-tasking and tombstoning on Day #14 of the 31 Days of Windows Phone.
A simple application manifest file that is required to generate the application package (XAP).
Another configuration file that contains the name and version metadata that is embedded into the generated assembly file.
This should be the image you use when your application is pinned to the Start screen. It would be smart to incorporate similar artwork to what you used in ApplicationIcon.png.
Your first application page. In nearly EVERY case, it should NOT be your only page. The phone handles forward and backward navigation very well, and you should not bury all of your application’s functionality into ONE xaml file. Break it up. You’ll thank me later. We’ll be covering page navigation in depth in tomorrow’s entry, Day #2 of the 31 Days of Windows Phone.
The code-behind for the MainPage.xaml file. When you need to make things happen in code, this is where you’ll generally write it. Interacting with the objects on the XAML file is almost always a necessity. During this series, we’ll be covering a great deal of topics that will require writing code in this (and other xaml code-behind) files.
This is the default image that is displayed if your application takes time to load. You can replace this with the image of your choice, but remember that this is really only meant to let the user know that they’re waiting for the actual application to load.
Another metadata field that contains application specific data, like title, icon locations, capabilities, etc.
Download This Code Example
Like I mentioned earlier, tomorrow’s post will be covering Page Navigation. See you then!
Leave a Reply