I need to load custom map tiles into my UWP Bing Maps app, and I need to load them from ApplicationData.Current.LocalFolder
.
What happens is that tiles are not loaded and the map is completely black.
While doing some troubleshooting I noticed that tiles from app package were loaded fine, and the issue was related to LocalFolder
and LocalCacheFoler
only.
So what I did was to copy the same image from app package to local folder (I'm copying to the correct one, even tested with images generated at runtime and stored in LocalFolder
) and use this code as tile source:
var localTileSource = new LocalMapTileDataSource();
localTileSource.UriRequested += async (s, e) =>
{
var deferral = e.Request.GetDeferral();
e.Request.Uri = (new Random().NextDouble() < 0.5) ? new Uri("ms-appdata:///local/background.png") : new Uri("ms-appx:///Assets/background.png");
deferral.Complete();
};
and this is what happens:
As you can see, local tiles are not loaded and thy're plain black while the very same file inside app package is loaded correctly.
Does anyone know what's going on?