Using Bing Maps as source for "Xaml MapControl"
In "XAML MapControl" you can also get the map tiles from Bing.
You need an API key. This can pe obtained from this site:
Building on the example from this blog post: "Minimal Example", The XAML markup will be:
<map:Map x:Name="MainMap" Center="59.9,10.7" ZoomLevel="4"> <map:BingMapsTileLayer Mode="AerialWithLabels" /> </map:Map>
But the API key has to be inserted somewhere i code before the map is displayed.
The place for this is dependant of your project; For a MVVM project it may be set in the initilization of the ViewModel (if you are using "model-first"). For a more basic tutorial scenario it may be set in the App.Startup or the initialization of the first form.
The code is either way:
using MapControl; public MyViewModel() // or whatever initializes { BingMapsTileLayer.ApiKey = "YOUR-MAP-KEY-HERE"; }
Comments
Post a Comment