windows-phone-8live-tile

Any way to resize text on the back of Windows Phone 8 Live Tiles?


I'm using a Flip Template for my tiles. On the MSDN page the text is seen to wrap, as well as be a smaller size.

This is not representative of behaviour I'm seeing in my live tiles. I can get a maximum of 3 lines, of large text, on the Wide live tile. The text does not wrap. This happens on all the different screen sizes of emulators. Frustratingly, I can get 4 lines of text on the Medium live tile, but the additional line of content is too long to fit there anyway so I don't include it.

I update my tiles periodically using a scheduled task:

Earthquake latest = quakes.First();
newTileData = new FlipTileData
{
    Title = String.Format(AppResources.LiveTileTitleFormat, quakes.Count),
    BackTitle = String.Format(AppResources.LiveTileTitleFormat, quakes.Count),
    BackContent = String.Format(AppResources.LiveTileBackContentFormat,  latest.FormattedMagnitude, latest.FormattedDepth),
    WideBackContent = String.Format(AppResources.LiveTileWideBackContentFormat, latest.FormattedMagnitude, latest.FormattedDepth, latest.RelativeLocation)
};

ShellTile tileToFind = ShellTile.ActiveTiles.First();
if (tileToFind != null)
{
    tileToFind.Update(newTileData);
}

The emulator on the left is attempting to show 4 lines. The emulator on the right is showing the text not wrapping.

enter image description here

So, is there any way to force a fourth line, or specify a smaller font size, or both? I suspect there isn't, and the MSDN article is simply showing Windows 8 (not WP8) live tiles.


Solution

  • It's not possible to resize text on WP8 tiles. You can fake it by creating an image and placing that on the tile instead:

    1. Create a user control that accommodate an image control and Text block
    2. Assign you tile image to image control and the text with desire size to text block.
    3. Then create a snapshot of the control through following code.
    4. use this image for implementing tile generation.

       private WriteableBitmap RenderControlAsImage(UserControl element)
       {
          element.UpdateLayout();
          element.Measure(new Size(element.Width, element.Height));
          element.Arrange(new Rect(0, 0, element.Width, element.Height));
          return new WriteableBitmap(element, null);
       }