.net WP8.1/Win10 UWP:在 Visual Studio 设计器中找不到 MapControl 的命名空间 [英] .net WP8.1/Win10 UWP: Namespace for MapControl not found in Visual Studio Designer

本文介绍了.net WP8.1/Win10 UWP:在 Visual Studio 设计器中找不到 MapControl 的命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 MapControl 时,Win 10 UWP 应用程序(VS2015、Win10)也会出现下面描述的问题.

the described issue below occurs also in a Win 10 UWP application (VS2015, Win10) when using the MapControl.

我在 Windows Phone 8.1(通用应用程序)应用程序中使用 MapControl 时遇到一个奇怪的问题.将控件添加到页面后,Visual Studio 说名称MapControl"在命名空间using:Windows.UI.Xaml.Controls.Maps"中不存在. 构建应用程序有效,我可以将其部署到手机并显示地图,一切正常 - 但我不能再为此页面使用设计器,因为它声称该错误.

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.

该问题发生在最初在 Windows 8.1 上的 VS2013(更新 4)中启动的一个更大的项目中.我的第一个想法是我的 VS 安装有点坏了.但在全新安装 Windows 10 (10240) 和 VS2015 RTM 之后,问题也出现了.我的重现步骤非常简单:

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:

  • 从模板Blank App (Universal Windows 8.1)"创建一个新项目
  • 打开WindowsPhone子项目的MainPage.xaml
  • 双击工具箱中的MapControl
  • 请注意,MapControl 已添加到 xaml 中的 Grid 并显示在并排设计视图中.一切似乎都很好.
  • 我现在只需单击工具箱就可以向页面添加更多控件.我可以在设计器中使用鼠标修改页面上的控件(例如重新排列它们),我可以通过属性窗格更改它们的属性.一切都还好.
  • 但是,当我在设计器中关闭并重新打开该页面(或整个项目)时,或者当我开始直接使用键盘编辑 xaml 时,设计器失败并声称出现上述错误.
  • Create a new project from template "Blank App (Universal Windows 8.1)"
  • Open the MainPage.xaml of the WindowsPhone subproject
  • Double click the MapControl in the toolbox
  • Note that the MapControl is added to the Grid 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.

这里有什么问题?如何让 Visual Studio 设计器再次使用 MapControl 的页面?首先,我想到了 VS2013 中的一个错误 - 但是复制起来很简单,在 VS2015 中没有修复并且互联网上没有关于它的信息?我做错了什么?

What's the problem here? How can I make Visual Studio designer to work with pages with MapControls 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?

推荐答案

Visual Studio Tools for Universal Windows Apps 1.0 存在一个错误,导致地图出现此问题,安装此更新应该可以解决此问题 更新

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

正确使用地图sdk的程序

Procedure to correctly use the map sdk

Windows 8.1

Windows 8.1

  1. 转到工具->扩展和更新 ->安装必应地图 SDK.
  2. 右键单击项目->添加引用->Windows->扩展->Bing 地图
  3. 将配置设置为 x86(配置属性 -> 配置)
  4. 使用 xmlns:maps="using:Bing.Maps"
  5. 将地图引用添加到您的页面
  6. 将此行添加到您的 xaml

现在你可以走了

Windows Phone 和 Windows 10 UAP

Windows Phone and Windows 10 UAP

在您的 xaml 中添加此引用

Add this reference in your xaml

xmlns:maps="using:Windows.UI.Xaml.Controls.Maps"

然后将此行添加到您的 xaml

and then add this line to your xaml

<maps:MapControl />

这篇关于.net WP8.1/Win10 UWP:在 Visual Studio 设计器中找不到 MapControl 的命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆