WP7 Problem with Tiles – orphans

I have a new WP app – Banner




that displays a message in the largest possible font for a given orientation as a scrolling banner. Inverted landscape displays a secondary message.  To allow the user quick access to a message, the original design included secondary tiles, but other than text, the tiles were all the same boring image. Luckily Robert Fonseca-Ensor provided a colourful solution. http://code.msdn.microsoft.com/wpapps/Building-Dynamic-Live-52bdc195 . As a demo, it worked great but there were a few issues. The first was how to create the image so the user did not see it. Placing it outside the viewing area would cause problems, so the obvious answer was to place it right in the middle. At first though, this sounds like it would mess up the UI, but if it is placed at the back behind a rectangle that matches the background colour, no one will know. I have used this “trick” many times in Visio. Remember if you do this to set the background or fill to “{StaticResource PhoneBackgroundBrush}” so it is hidden in borth dark AND light themes.

The big problem I ran into is with how the tiles are handled. The user has full control of the tiles life / death, but there is no way to let the app know that the image file created in isolated storage is no longer needed if the tile is deleted. The only thing provided by the ActiveTile collection is the uri that the tile uses to run the app.  So deleting a tile will create an orphaned image. One solution is to provide a cookie crumb of information in the Uri and some backwards logic. Once deleted, you can not check the uri to find out which tile has been deleted, but you can scan the existing tiles and find out which images are active. The rest of the images in the list are the orphaned ones.

I had an extra wrinkle to the tile issue, the tiles I create for the banner app are identical except for the colours, so I could reuse the tiles. I chose to name the tiles after the two colours used in the tile, the background colour and the text colour. To keep things simple I used the hex values of the colours as the image names. One issue I did run in to was that converting the colours to hex values resulted in a string starting with “#” which was not appreciated by the system. I am not sure why. The tile was created and functioned properly, but the tile image was just a plain rectangle using the accent colour. Removing the “#” got around the problem.

Another issue is that you can not rely on the date stamp of the file in isolated storage, so this should be taken into account when determining the image file names.

Anyone need a banner app to send messages during a presentation or as a greeter board at the airport?

John Marshall… Visio MVP       Visio.MVPs.org

Published by johnvisiomvp

The original Visio MVP. I have worked with the Visio team since 1993

2 thoughts on “WP7 Problem with Tiles – orphans

  1. Very cool John and great tips! :> Is there no way to create that image using just memory? It has to go on the page (with your trick)?

    1. Hiding the image on the main page is not a big deal, but while the tile exists, the image has to live somewhere. So isolated storage is the easiest.
      I open to suggestions for other ways to dynamically create the images.

Comments are closed.