Similar to this question but for a Bing Map SDK embedded in a C#/XAML Windows Store app.
How do I offset the where 'center' is for e.g. double tapping to zoom and other behaviours?
Similar to this question but for a Bing Map SDK embedded in a C#/XAML Windows Store app.
How do I offset the where 'center' is for e.g. double tapping to zoom and other behaviours?
If creating a Windows Store app (Windows 8/8.1) using the Bing Maps SDK you can offset the center of the map by first grabbing the center location of the map, converting the location into a pixel coordinate. Apply an offset to the pixel coordinate and then convert the pixel back into a location and set the maps center using that location. Here is a code sample:
//Convert the center location of the map into a pixel value.
Point centerPixel;
myMap.TryLocationToPixel(myMap.Center, out centerPixel);
//Apply an offset to the pixel value.
centerPixel.X += [offset value];
centerPixel.Y += [offset value];
//Convert pixel coordinate back into location object.
Location center;
myMap.TryPixelToLocation(centerPixel, out center);
//Center the map using the offset value.
myMap.Center = center;
All that said, I would recommend developing for Windows 10 rather than Windows 8. Windows 10 already exceeds Windows 8 in marketshare and there is a brand new Bing Maps control built right into the Windows 10 SDK. Here is some documentation: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642089.aspx