In Bring your Application Tile to life I talked about how the Glance and Go philosophy of the Windows Phone Start enables me to check my phone, quickly get to important information and get back to my life. Not only can Windows Phone users pin applications to the start screen, they can link individual contacts, songs, pictures and web sites to Secondary Tiles.
Secondary Tiles allow an application to deep link to items managed by the application. A recipe application might allow a user to pin a single recipe, and a To Do List application might pin a specific task. When the user taps the Secondary Tile, the application should start up with the linked item already in focus.
Consider an application that displays a list of items on its main page. When the user taps the item in the list, the application navigates to a details page by building a navigation Uri and calling the Navigate method of the NavigationService.
NavigationService.Navigate( new Uri(
"/DetailsPage.xaml?selectedItem=" + selectedId, UriKind.Relative));
Secondary Tiles utilize the same pattern when navigating to a linked item. The Secondary Tile contains the same navigation Uri to the details page. Instead of launching the normal startup page, the tile launches directly to the details page specified in the navigation Uri.
The StandardTileData and ShellTile classes are used to create and update Secondary Tilea. In fact, the only real difference between an Application Tile and a Secondary Tile is the navigation Uri.
StandardTileData tileData = new StandardTileData
Title = "selected item",
BackgroundImage = new Uri("ItemBackground.png", UriKind.Relative),
BackBackgroundImage = new Uri(
Uri tileUri = new Uri(
"/DetailsPage.xaml?selectedItem=" + itemId, UriKind.Relative);
Secondary Tiles can be updated from a background agent and push notifications. Unlike the Application Tile, Secondary Tiles are removed from the ActiveTiles collection when they are removed by the user from the start screen.
You should be careful when allowing the user to create a pinned tile. If an item is already pinned, the user should not have the option to pin it a second time. The NavigationUri is the unique key and if you try to create a second Secondary Tile with the same navigation Uri, the Create method will throw an exception.
You can also programmatically delete a tile. This is useful if the linked item is deleted from the application such as when the user deletes a recipe.
Safari Books Online has the content you need
Check out these Windows Phone 7 books available from Safari Books Online:
Windows 7 Plain & Simpleis your easy, colorful, SEE-HOW guide to Windows Phone 7. You’ll learn the quickest ways to set up and use your new phone with easy-to-follow steps, screenshots, and concise, straightforward language that make learning plain and simple!
|Windows Phone 7 provides an exciting new opportunity for companies and developers to build applications that travel with users, are interactive and attractive, and are available whenever and wherever users want to work with them. Windows Phone 7 Developer Guide walks through a series of fictional, but realistic scenarios involved in building a phone application that uses a mobile front end talking to a cloud backend.|
|Microsoft Silverlight Edition: Programming Windows Phone 7 helps you get started building applications for Windows Phone 7, expertly guided by award-winning author Charles Petzold. You’ll focus on the core concepts and techniques for creating apps with Microsoft Silverlight. Charles brings a unique combination of pragmatism and authority to his instruction—along with an eminently readable style and a wealth of hands-on examples.|
|In Microsoft XNA Framework Edition: Programming Windows Phone 7, you’ll focus on the core concepts and techniques for creating apps with Microsoft XNA. Charles brings a unique combination of pragmatism and authority to his instruction—along with an eminently readable style and a wealth of hands-on examples.|
|Microsoft XNA Game Studio 4.0: Learn Programming Now! is your hands-on introduction to computer programming with Microsoft Visual C# 2010 and XNA Game Studio 4. Get fun, easy-to-follow instructions for customizing your Xbox 360 games—or creating your own!|
About the Author
|Timothy Binkley-Jones is a staff engineer in the Cloud Infrastructure and Management group of VMware, Inc. Tim is a co-author of Windows Phone 7 in Action by Manning Publications, and regularly speaks about mobile application and cloud development at user groups and conferences in the Colorado area. Tim has been developing commercial IT management applications for 15 years. You can follow his blog at blogs.magnatis.com/tim or follow him on twitter at @timblinkleyjones.|