问题
Edit: the described issue below occurs also in a Win 10 UWP application (VS2015, Win10) when using the MapControl.
I have a weird problem using the MapControl in a Windows Phone 8.1 (universal app) application. After adding the control to a page, Visual Studio says The name "MapControl" does not exist in the namespace "using:Windows.UI.Xaml.Controls.Maps".
Building the app works, I can deploy it to the phone and the map is shown and everything is fine - but I cannot use the Designer for this page any longer since it claims that error.
The problem occured in a bigger project originally started in VS2013 (update 4) on Windows 8.1. My first thought was that my VS-installation was kind of broken. But also after a clean new installation of Windows 10 (10240) and VS2015 RTM the problem occured. My steps to reproduce are quite simple:
- Create a new project from template "Blank App (Universal Windows 8.1)"
- Open the
MainPage.xaml
of theWindowsPhone
subproject - Double click the
MapControl
in the toolbox - Note that the
MapControl
is added to theGrid
in xaml and it is shown in side-by-side design view. Everything seems to be ok. - I can now add more controls to the page just by clicking the toolbox. I can modify the controls on the page with the mouse in the designer (e.g. rearrange them) and I can change their properties by the properties pane. Everything is still ok.
- But when I either close and reopen that page (or the whole project) in the designer or when I start to edit the xaml directly with the keyboard, the designer fails and claims the error described above.
What's the problem here? How can I make Visual Studio designer to work with pages with MapControl
s again? First I thought of a bug in VS2013 - but that simple to reproduce, not fixed in VS2015 and no information about it on the internet? What did I wrong?

回答1:
There is a bug on Visual Studio Tools for Universal Windows Apps 1.0 causing this issue with the map, installing this update should fix the issue Update
Procedure to correctly use the map sdk
Windows 8.1
- Go to Tools-> extension and update -> install Bing Map SDK.
- Right click on the project->Add reference->Windows->Extensions->Bing maps
- Set configuration to x86 (Configuration Properties -> Configuration)
- Add the map reference to your page using
xmlns:maps="using:Bing.Maps"
- Adding this line to your xaml
<maps:Map />
and now you are good to go
Windows Phone and Windows 10 UAP
Add this reference in your xaml
xmlns:maps="using:Windows.UI.Xaml.Controls.Maps"
and then add this line to your xaml
<maps:MapControl />
回答2:
Set configuration to x86 instead of "Any CPU". For prioritising fix upvote at https://connect.microsoft.com/VisualStudio/feedback/details/1659249/visual-studio-2015-rtm-uwp-the-name-mapcontrol-does-not-exist-in-the-namespace-using-windows-ui-xaml-controls-maps
回答3:
Make the correct map library reference
xmlns:Maps="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
Instead of
xmlns:Maps="using:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
来源:https://stackoverflow.com/questions/31534197/net-wp8-1-win10-uwp-namespace-for-mapcontrol-not-found-in-visual-studio-design