Impossible to display the map. I still have a error message:
"Invalid Credentials. Sign up for a developer account at: http://www.microsoft.com/maps/developers"
However, I created a account correctly and obtained a valid key:
- Application name: Geography
- Key: *My key*
- Application Url:
- Key type: Basic / Dev/Test
- Created date: 08/12/2015
- Expiration date: None
My xaml code:
<Window x:Class="Geography.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
Title="MainWindow" Height="350" Width="525">
<Grid>
<m:Map CredentialsProvider="*My key*">
</m:Map>
</Grid>
</Window>
It was a proxy whose I ignore the existence.
So, I set the following config in my app.config file and the error message no longer appears:
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress="http://ProxyAddress:Port"/>
</defaultProxy>
</system.net>
Try this code
<Window x:Class="Geography.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
Title="Maps" Height="350" Width="525" Style="{StaticResource OfficeStyle}">
<Grid>
<m:Map CredentialsProvider="/*YOUR ID*/" x:Name="myMap" />
</Grid>
</Window>
Then add it into cs code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Maps.MapControl.WPF;
namespace Geography
{
/// <summary>
/// Interaction logic for Maps.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
myMap.Focus();
//Set map to Aerial mode with labels
myMap.Mode = new AerialMode();
}
}
}
go following link to get more details: https://msdn.microsoft.com/en-us/library/hh830433.aspx