Hello everyone,
I need to get an image from a Map (Windows Phone 8), to use it for a live tile. This is what I have so far:
As you can see, the map that I render is never part of the visual tree. I gather from several places (stackoverflow, msdn) that this should not be a problem; unfortuately, the image is simply black.Code:const int imgSize = 210; Map tempMap = new Map { Width = imgSize, Height = imgSize }; // ... adding some layers, setting the view Size size = new Size(imgSize, imgSize); tempMap.Measure(size); tempMap.Arrange(new Rect(new Point(0, 0), size)); tempMap.UpdateLayout(); WriteableBitmap bmp = new WriteableBitmap(imgSize, imgSize); bmp.Render(tempMap, null); bmp.Invalidate(); IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication(); string filename = "/Shared/ShellContent/" + /* ... file name */ ".jpg"; using (IsolatedStorageFileStream stream = store.OpenFile(filename, FileMode.OpenOrCreate)) bmp.SaveJpeg(stream, imgSize, imgSize, 0, 100); tile.Update(new FlipTileData { // ... set other properties BackgroundImage = new Uri("isostore:" + filename, UriKind.Absolute) });
Is something wrong with my code, or might this be a bug with the Nokia Map?

Reply With Quote

