I use the following code to take a user control, make a bitmap from it, and then save it in isolated storage for WP8 Live Tile.
public static void UpdateTile() { var frontTile = new LiveTileRegular(); // Custom Control frontTile.Measure(new Size(173, 173)); frontTile.Arrange(new Rect(0, 0, 173, 173)); var bmp = new WriteableBitmap(173, 173); bmp.Render(frontTile, null); bmp.Invalidate(); const string filename = "/LiveTiles/LiveTileRegular.jpg"; using (var isf = IsolatedStorageFile.GetUserStoreForApplication()) { if (!isf.DirectoryExists("/LiveTiles")) { isf.CreateDirectory("/LiveTiles"); } using (var stream = isf.OpenFile(filename, FileMode.OpenOrCreate)) { bmp.SaveJpeg(stream, 173, 173, 0, 100); } Debug.WriteLine("Image Exists: " + (isf.FileExists(filename) ? "Yes" : "No")); // Displays "Yes" } ShellTile.ActiveTiles.First().Update(new FlipTileData { Title = "Title", BackgroundImage = new Uri("isostore:" + filename, UriKind.Absolute), }); // Throws a NotSupportedException }
NotSupportedException gets the ShellTile.ActiveTiles.First().Update() method with very non descriptive messages.
Is there something that I'm obviously doing wrong?
source share