我想出了一个解决办法。由于本地图像在渲染中起作用,我决定使用临时图像。在渲染XAML之前,我下载了图像,将其保存到磁盘并使用该路径作为图像源。
此方法类似于:
public string GetGoogleMapsImage(string lat, string lng, string path)
{
string googleMapsImage =
string.Format(
"http://maps.google.com/maps/api/staticmap?center={0},{1}&zoom=8&size=250x150&sensor=false" , lat, lng);
string returnpath;
using (var w = new WebClient())
{
var gm = w.DownloadData(googleMapsImage);
returnpath = path + "\\~googletemp" + DateTime.Now.Ticks + ".png";
File.WriteAllBytes(returnpath, gm);
return returnpath;
}
}