Windows phone 8 Windows Phone 8:如何将不可见贴图渲染为位图?

Windows phone 8 Windows Phone 8:如何将不可见贴图渲染为位图?,windows-phone-8,writeablebitmap,here-api,Windows Phone 8,Writeablebitmap,Here Api,以下是我目前掌握的情况: 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), si

以下是我目前掌握的情况:

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)
});
我想用地图的图像更新活动互动程序(WP8,来自诺基亚)。根据,即使不属于可视树的UIElements也可以使用WriteableBitmap进行渲染;然而,我的图像只是黑色的。这是地图控件的问题,还是我做错了什么

编辑1:Windows Phone WriteableBitmap类似乎与完全不同。奇怪

编辑2:

编辑3:部分进度! 添加以下三行:

tempMap.Width = imgSize // right before the measure call. DO NOT set the height.
(Content as Grid).Children.Add(tempMap) // right after creating tempMap. (your layout may vary)
(Content as Grid).Children.Remove(tempMap) // after you're done. (your layout may vary)

这会产生一个完全蓝色的图像,而不是一个完全黑色的图像。更改tempMap.Center和tempMap.ZoomLevel对平铺没有影响;调用tempMap.SetView根本没有任何效果(为了调试,我将映射留在我的应用程序页面中,以便查看调用的效果-互动程序不是映射在页面中的样子)

我自己尝试过,但也无法使其工作。不过,我还是通过使用Bing的静态MapAPI解决了这个问题。然后我就可以下载一张地图,指定为我想要的确切尺寸,然后使用它。下面的链接展示了如何使用它,并给出了获取API密钥的链接(只需一秒钟)