3

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.

Adam S
  • 16,144
  • 6
  • 54
  • 81
  • 2
    No that is not possible sorry. A solution is to write the text on the tile-picture yourself instead of using the built-in properties. – robertk Dec 09 '12 at 09:41
  • It appears that you are right. Rather disappointing. If you'd like to to add this as the answer I'll accept it - "not possible" is a valid answer! – Adam S Dec 10 '12 at 21:39

1 Answers1

4

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);
     }
    
Adam S
  • 16,144
  • 6
  • 54
  • 81
Rakesh R Nair
  • 1,736
  • 2
  • 12
  • 30
  • I had trouble with this and wp8, i needed to call the element inside to get the width and height otherwise i got NaN `element.Measure(new Size(element.Content.DesiredSize.Width, element.Content.DesiredSize.Height));` – Choco Smith Aug 07 '13 at 17:16