Item templates are app files that contain commonly used code that can be added to a project template to reduce development time.
The item templates contain the appropriate references and script tags to support Windows Windows Store apps. Some of the item templates implement a contract, which is like an agreement that one or more apps can use specific APIs. When you add a contract template (Search Contract, File Open Picker Contract, Share Target Contract), the app manifest is updated with the appropriate declarations to notify Windows that your app supports this contract. You can see the settings for these declarations on the Declarations tab of the Manifest Designer.
You can add an item template to a project by right-clicking the project in Solution Explorer and then clicking Add > New Item.
Template descriptions
This table summarizes the types of item templates available in Visual C#, Visual Basic, or Visual C++ for Windows Store apps.
| Template | Description | Inherits from LayoutAwarePage |
| Pages | ||
| Basic Page | A minimal page with layout awareness, a title, and a back button control. | Yes |
| Blank Page | A blank page. | No |
| Group Detail Page | A page that displays details for a single group and previews each item in the group. | Yes |
| Grouped Items Page | A page that displays item previews arranged in groups. | Yes |
| Item Detail Page | A page that displays one item in detail along with navigation to adjacent items in the same group. | Yes |
| Items Page | A page that displays a collection of items. | Yes |
| Split Page | A page that displays a list of items and the details for a selected item. | Yes |
| Contracts | ||
| File Open Picker Contract | An app contract that enables supplying files to other apps. This item template enables an app to expose its data as files to other apps. For example, you can use this template to create a photo picker dialog box from which the user can pick a photo from Facebook, even if the photo isn't stored on the local hard drive. For more info, see Integrating with file picker contracts. | Yes |
| Search Contract | An app contract that supports displaying search results. For more information, see Quickstart: Adding search to an app . | Yes |
| Share Target Contract | An app contract that supports receiving items shared by other apps. This item template enables an app to coordinate data sharing among other apps. For example, you can use this template to enable users to post a photo from Flickr on Facebook. This template includes code that enables the app to receive shared content. The app that contains this item template is started when the app is selected in the share UI. For more information, see QuickStart: receiving shared content. | Yes |
| Other | ||
| Class | An empty class definition. | No |
| Resource Dictionary | An empty, keyed collection of XAML resources. | No |
| Resources File (.resw) | A file for storing string and conditional resources for your application. To help localize a Windows Store app, you can add one or more Resources File item templates to your project. For more info, see Globalizing your app. | No |
| Templated Control | A blank custom control with the appropriate default styling. | No |
| Unit Test | An empty unit test. | No |
| User Control | A blank user control. | No |
Item Templates that inherit from LayoutAwarePage
The Windows Store item templates defined above are complex pages. All the templates inherit from LayoutAwarePage and have dependencies on items located in the Common folder that's automatically added when you create an app in the Grid App or Split App templates. If any of the required references can't be found, you'll be prompted to add the required files.
| Action | Why choose this? | What happens? |
| Yes |
|
The required dependencies are added to the Common folder. If the folder already exists, all missing items are added. No existing files are modified. If the folder doesn't exist, it's created and all items are added to it. |
| No |
|
The new item is added. No other files are added or modified. |
| Cancel |
|
The project isn't changed, and the item isn't added. |
Note The required files are: BindableBase, BooleanNegationConverter, BooleanToVisibilityConverter, LayoutAwarePage, RichTextColumns, SuspensionManager, and StandandStyles.
Related topics
- C#/VB/C++ project templates for Windows Store apps
- Adding a Page Control item template (using C#/VB/C++ and XAML)
- Adding a Search Contract item template (using C#/VB/C++ and XAML)
Build date: 3/11/2013