In a previous blog post, I wrote about using a UserControl to generate images for live tiles. This is still a great technique, however it needs to be tweaked a bit in order to prepare it for Windows Phone 8.1.

The problem with this technique, is that it does not work with the new feature of placing an image on the tile. According to the documentation, in order to let the system know it can place the image over your tile, you need to set the color to transparent.

My first attempt was to simply set the background of my UserControl to transparent. While I did need to do this, it failed. Why? It was this line right here.

Jpeg’s do not support transparency! <facepalm/> Also, there is no out of the box way to save to png. To solve this, you can need a library called imagetools. You can add it as a nuget package too, however, be careful. Only select the PCL package if you absolutely need it. The silverlight version should be just fine for most phone applications.

Once you have the package installed, its a minimal change in order solve this. Replace the line above with the lines below.

 Voila! now we have beautiful transparent live tiles!

TransparentLiveTile

Update!

This method still takes a little bit more memory usage than I would prefer. Especially since this method is intended to be called from the background task, where memory is precious. If you can swing it, The Telerik Windows Phone tools provide another option for $99 (you get a lot of other cool stuff too though). Replace the original line of code above with the following.

Other than the need for another using statement, we can swap one line of code for another, and it sips on the memory much better.

Leave a Reply
Your email address will not be published.
  • ( will not be published )