Building a great Windows 8 app Step 6: Which template should you use?

You are about to start coding your Windows 8 project, what template should you start with?

This blog is part of a series.

Picking the right template at the start of your project can save you a lot of work! Finding the right Visual Studio template, or finding a project template out there that is similar to what you are trying to build may mean some of the features you want are already coded and ready to go.This post will cover:

  • Visual Studio templates
  • Open source Windows 8 templates
  • Windows 8 Sample projects

Visual Studio templates

When you choose File | New Project  and choose Installed | Templates | <Programming Language> | Windows Store you see up to 6 different project templates to choose as a starting point. Let’s see when you should use each one:

Blank app

This template will create a very simple one page application, popular with single page applications such as timer apps, and one page puzzle apps, or apps with multiple screen navigation that does not follow the flow of other pre-defined templates.

Blank App

Grid App

This template is good for apps that have a drill down or parent-child style of navigation. The template is designed to show one or more categories on a page called GroupedItems (or GroupedItemsPage) which is the default start page. If you select a group, details about a group are displayed on a page called GroupDetail (or GroupDetailPage). If you select an item, details about the selected item are displayed on a page called ItemDetail (or ItemDetailPage). This template works well for many apps that allow you to navigate through a lot of information such as store apps, blog reader apps, photo organizer apps, and teaching apps. If you choose to use this template, check out the Windows 8 camp in a box which includes a hands-on lab that tells you step-by-step how to create an app with sample data, and add features like snap, search, semantic zoom, and share using this template. It’s a very good resources for learning how to add features to this template.

Windows store grid app

Split App

This is a template for a two page project. Designed for a Parent-child or drill down style of navigation. The difference between the Split and Grid App, is that when you select a group with this template it brings you to a page that is split in two. One half of the page will list all the items in the group, the other half of the page lists the details of any item you select within the group. The default start page is the Items (or ItemsPage) which lists all the groups. The page that lists the items and the details for the selected item is called Split (or SplitPage)

Windows Store Split App

Class Library

Class libraries are useful when you have code you want to use in multiple applications. You can put the re-usable code into a class library and compile it into a .dll and then import it into one or more projects.

If you want to re-use code across Windows 8 and Windows Phone or other .NET Platforms, you should consider using Portable Class Libaries instead.

Windows Runtime Component

If you are building a JavaScript project but you want to use a feature that is written in C# or C++ (either created by you or maybe from a 3rd party), you want a Windows Runtime Component. This project type allows you to wrap the functionality in a Windows Runtime Component so it can be references from JavaScript

Unit Test Library

Unit testing is a great way to find logic errors in your code. You can use the Unit Test Library to create test methods that will allow you to retest your application as often as needed.

Direct2D App (C++ only)

Used for developing C++apps with 2D graphics, including games. Nice little blog post on getting started with it here. There’s also a good video from Build, and some sample Direct2D projects.

Direct3D App (C++ only)

Used for developing C++ apps with 3D graphics, including games, to get started with this template, check out this video from build and some sample Direct3D Projects

DLL (C++ Only)

If you want to write code in C++ that can be re-used across projects. Use this template and you can create a dynamic link library (DLL) you can reuse in multiple Windows store apps or components.

Static Library (C++ Only)

If you want to write code in C++ that can be re-used across projects. Use this template and you can create a static library (.lib) you can reuse in multiple Windows store apps or components.

Hmmm sounds similar to a DLL project doesn’t it? So what’s the difference between static and DLL (dynamic) libraries? When you compile a project that includes a static library, the library actually becomes part of the executable. That means your executable is bigger and it means whatever version of the code you compiled with is the version of the library that will run. When you compile a project that references a dynamic library, it is not compiled as part of the executable. If the same dynamic library is called by multiple projects it is only loaded once. Also the dynamic library can be upgraded to a newer version without replacing all the executables that use it.

Fixed Layout (JavaScript Only)

This is similar to the blank app template except this template has the infrastructure to scale for larger screens. For applications with a lot of graphics, such as games, this is very useful. Here’s a post by Chad Carter on creating a Fixed Layout App project.

This is basically a blank app but it has predefined controls for navigation, so if your app is going to have more than one screen, this is a like a blank app that has more support for navigation between pages. (thank you to Infragistics for Brent’s Bytes blog on templates which helped me in my research). Here’s a post by Chad Carter on creating a Navigation App project.

Navigation App


Open Source Templates

Sometimes developers create templates for common applications that you can quickly update to suit your needs. Here’s a few you might find useful

WordPress site template

Created by IdeaNotion, If you are using for your website and you want to bring your content to the store, check out this template that lets you view blog posts by category, view your pages, view and post comments, see post information in a live tile, and use the Search and Share charms. You can download the source code here, and find a quick start guide here.

Club or team template

This club/team template allows you to easily create an app for members of a club or team. You can share information about members of the team or executive, a blog, and upcoming events.

I will be sharing a second version of this template shortly that also allows you to share photos and a twitter feed through the application as well. I will update this blog when that template becomes available

RSS Feed reader

What mobile app list of templates would be complete without the blog reader template. It seems like the Hello World of mobile apps.

HTML/CSS Game kit

This is a simple HTML5/JavaScript app that you can use as a starting point for building a JavaScript game

Windows 8 sample projects

Here’s a few interesting samples you can also check out to find code examples for different tasks

  • Note Taker 
  • Calculator 
  • And last but absolutely not least, don’t miss out on the Windows Store app samples a searchable library filled with all kinds of great code examples! Search for Music, geolocation, photos, skydrive, facebook, and find useful code examples for a variety of needs!