I just spent the better part of the morning trying to update a Live Tile’s Background and BackBackground image in WP7.
The reason it took more than the 5 minutes it should have taken is because most people who paste code on development blogs put too much weight into their assumptions about what other people may or may not know. In my case, the omission was with visual studio file/asset properties. The following piece of code was supposed to ‘just work’:
{
{
BackgroundImage = new Uri(“livetilefront.png”, UriKind.Relative),
BackTitle = ” “,
BackBackgroundImage = new Uri(“livetileback.png”, UriKind.Relative),
BackContent = “”
};
appTile.Update(standardTile);
}
However, the author failed to mention that you need specific properties on the livetilefront.png and livetileback.png images otherwise they won’t be displayed. Those properties are:
Build Action: Content
Copy to Output Directory: Copy always (‘Copy if newer’ should suffice as well).
Without these settings, the images were not being copied into the XAP file, and as such were not showing on the Live Tile. Now, I’ve been reading some articles that suggest that the ‘copy to output directory’ shouldn’t have affected the content in the xap file, which is what I originally though as well (which is why it took me so long to solve this problem). So unless there is something wrong with my Visual Studio environment, this is the way things need to be.
Note: The PhoneGameThumb.png file does not have ‘Copy always’ set and yet it appears in the output directory. So I’m not sure what is going on here, but I’m just glad everything is working now. I’ll save the investigation for some other time.
Leave a Reply