C#, VB, and C++ item templates for Store apps
[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]
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 Store apps and Windows Phone 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 (File Open Picker Contract, Share Target Contract), the app manifest is updated with the appropriate declarations to notify Windows or Windows Phonethat 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.
This table summarizes the types of item templates available in Visual C#, Visual Basic, or Visual C++ for Windows Runtime apps.
Requires common files
A minimal page, containing a title and a back button, that uses NavigationHelper.
A blank page.
Group Detail Page
A page that displays details for a single group and previews each item in the group.
Grouped Items Page
A page that displays item previews arranged in groups.
A page that displays item previews arranged in sections and that uses a varied presentation for each section.
Item Detail Page
A page that displays one item in detail along with navigation to adjacent items in the same group.
A page that displays a collection of items.
A page that supports displaying search results.
A page that displays a list of items and the details for a selected item.
The navigation model used in the Page Control item templates is also used in the Hub, Grid, Split, and Navigation project templates. We recommend using this item template when you add pages to these project templates. For more info, see Quickstart: Navigating between pages.
|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|
|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|
|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|
|Settings Flyout||A blank Settings Flyout page.||No|
|Templated Control||A blank custom control with the appropriate default styling.||No|
|User Control||A blank user control.||No|
Adding required files
Some of the Windows Store and Windows Phone item templates defined above are complex pages and have dependencies on NavigationHelper, SuspensionManager, and other common files included in the project templates. These files are located in the Common folder that's automatically added when you create an app using the Hub App, Grid App, or Split App project templates. If any of the required references can't be found, you'll be prompted to add the required files.
Note The required files vary depending on the specific item template you are adding. The complete list of common files includes: NavigationHelper, SuspensionManager, RelayCommand, BooleanNegationConverter, and BooleanToVisibilityConverter. For more info on these files, see C#/VB/C++ project templates for Windows Store apps.
The following table provides info on how to proceed when prompted to add required files.
|Action||Why choose this?||What happens?|
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.
The new item is added. No other files are added or modified.
The project isn't changed, and the item isn't added.