Windows Phone 7.8 Tutorial
The new SDK 7.8 for Windows Phone enables to use many new tiles on existing 7.1 phones that were introduced in Windows Phone 8.
Article Metadata
Contents |
Windows Phone 7.8
Windows Phone 7.8 brings 3 sizes to tiles to the start screen of the 7.x line of Windows Phones. Now, users can reorganize their start screen the same way as Windows Phone 8. But for developers, Windows Phone 7.8 is actually a minor update, the SDK 7.8 is only an update to the previous SDK with no visible API changes. Windows Phone 7.8 is actually code version 7.10.8858.
Creating a new Windows Phone 7.8 application
When you create a new application, there are only two targets, so you need to select 7.1 as target for your Windows Phone 7.8 app.
Setting up the project
Some manual editing is required to enable the new live tile features in a Windows Phone 7.1 project. You need to open WMAppManifest.xml using the xml editor, and add an AppExtract block right before the App element
<?xml version="1.0" encoding="utf-8"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
<AppExtra xmlns="" AppPlatformVersion="8.0">
<Extra Name="Tiles" />
</AppExtra>
<App ...>
...
</App>
</Deployment>
See [1] for more details
New tile classes
There are three new classes in the SDK 7.8 for the tiles:
But unfortunately, since there is no new target, these classes are not visible in Visual Studio. To create and configure your tiles, the only option is to use reflection.
Using the new tiles
The easiest way to create wide tiles is to use the MangoPollo Library (and also this article details how the reflection works). It is a click away using NuGet. The beauty of MangoPollo, is that you can write a single code that will work for all Windows Phone versions.
To configure the default tile with a wide background image, you can use the following code
var tileId = ShellTile.ActiveTiles.FirstOrDefault();
if (tileId != null)
{
var tileData = new FlipTileData();
tileData.Title = "My app";
tileData.BackContent = "";
tileData.BackgroundImage = new Uri("/Images/Icon173x173.png", UriKind.Relative);
tileData.BackBackgroundImage = new Uri("/Images/Icon173x173_back.png", UriKind.Relative);
tileData.WideBackContent = "";
tileData.WideBackgroundImage = new Uri("/Images/Image346x173.png", UriKind.Relative);
tileData.WideBackBackgroundImage = new Uri("/Images/Image346x173_back.png", UriKind.Relative);
Debug.WriteLine("Activating live tile: " + Mangopollo.Utils.CanUseLiveTiles);
tileId.Update(tileData);
}
The reflection underneath will configure the tile according to the phone version.
Tile sizes
I haven't found an exact document that specifies the optimal sizes for Windows Phone 7.8 but here are my guesses:
- 173x173 for the square ones
- 346x173 for the wide ones
- 82x82 for the small ones
Can see the follow article (MSDN)Windows Phone OS 7.1 Tiles, which contains some information about this subject.
Limitations
- Unlike Windows Phone 8, Wide tiles are only possible programatically, there are no new options in the manifest and neither in the visual studio editor
- It is not possible to set a wide live tile as default tile (you need to start the app once to set a new default tile programatically)
- The only way to configure the default tile is to replace the default tile with a new one using ShellTile.Update
- Remote live tiles don't seem to work on actual devices (see below)
Remote live tiles
I spent a lot of time trying to setup remote live tiles in Windows Phone 7.8 and Windows Phone 8 projects and it is an obscure area, the limitations of Mango are still here Tips and tricks about updating live tiles in Mango.
- Remote live tiles (pull mode) work perfectly in the emulator
- On an actual device, remote (pull mode) tiles simply don't seem to work at all. My Lumia 800 refuses to set my tile in wide mode as soon as any of my URLs is a remote one.
- The only solution is to use the isostore to store images and update them using a background agent
Summary
With a bit of code, you can make use of the new live tiles features for both Windows Phone 7.8 and Windows Phone 8. Except the default live tile, it will all look the same from an end user perspective, and unless your app needs other new Windows Phone 8 features, you can write a single code for all devices.



Hamishwillee - Thanks for the article
Thanks for the article. There is some significant overlap with Use new tiles on Windows Phone apps using reflection (and some useful associated information in Co-development for Windows Phone 7/8 and Windows 8 guide). What extra do you think your article adds over and above that content?
(I'm not saying it doesn't add anything, just that I haven't looked closely enough yet). We try to avoid duplicating material, and it might be worth trying to merge them if they cover the same material.
Regards
Hamishhamishwillee 08:39, 4 March 2013 (EET)