wpf 尝试将 Gmap.Net 控件添加到工具箱

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13162703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 06:01:12  来源:igfitidea点击:

trying to add Gmap.Net control to toolbox

c#wpfvisual-studio-2012gmap.net

提问by Julien

I have a WPF application targetting .Net framework 4.5 in Visual Studio 2012.

我在 Visual Studio 2012 中有一个面向 .Net framework 4.5 的 WPF 应用程序。

I have added references to GMap.NET.Core and System.Data.SQLLite.

我添加了对 GMap.NET.Core 和 System.Data.SQLLite 的引用。

In my App.config I have added

在我的 App.config 中,我添加了

   <startup useLegacyV2RuntimeActivationPolicy="true"> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
    </startup>

I open my Map.xaml page in VS, open the toolbox, right click, hit choose items.

我在 VS 中打开我的 Map.xaml 页面,打开工具箱,右键单击,点击选择项目。

Change tab to .NET Framework Components, Browse, select GMap.Net.WindowsForms.dll. I see the entry for GMapControl pop up in the list, it's checked, I hit OK, I am then presented with the following:

将选项卡更改为 .NET Framework Components,浏览,选择 GMap.Net.WindowsForms.dll。我在列表中看到 GMapControl 的条目弹出,它被选中,我点击“确定”,然后我会看到以下内容:

enter image description here

在此处输入图片说明

I never end up seeing the control in my toolbox. Help!

我从来没有在我的工具箱中看到控件。帮助!

Edit: If I right click and hit Show All, I do see the control, it's just greyed out.

编辑:如果我右键单击并点击Show All,我确实看到了控件,它只是变灰了。

回答by Nick

Bit late but just in case it helps anyone:

有点晚了,但以防万一它可以帮助任何人:

for WPF there is a different GMap.net to download: GMap.NET.WindowsPresentation

对于 WPF,有一个不同的 GMap.net 可供下载:GMap.NET.WindowsPresentation

Once you have this:

一旦你有了这个:

  • Add the GMap.NET.Core.dll and GMap.NET.WindowsPresentation.dll into your project file
  • Add references to GMap.NET.Core.dll and GMap.NET.WindowsPresentation.dll
  • Add in the toolbox by browsing to GMap.NET.WindowsPresentation.dll
  • 将 GMap.NET.Core.dll 和 GMap.NET.WindowsPresentation.dll 添加到您的项目文件中
  • 添加对 GMap.NET.Core.dll 和 GMap.NET.WindowsPresentation.dll 的引用
  • 通过浏览到 GMap.NET.WindowsPresentation.dll 添加到工具箱中

If you get a message about

如果您收到关于

"the assembly could not be loaded this assembly may have been downloaded from the web"

“无法加载程序集,此程序集可能是从网上下载的”

then you need to change the properties of the two .dll files and unblock them.

那么您需要更改两个 .dll 文件的属性并取消阻止它们。

I found this guide helpful, although it is for Windows Forms, not Windows Presentations:

我发现本指南很有帮助,尽管它适用于 Windows 窗体,而不是 Windows 演示:

http://www.websofia.com/2013/02/gmap-net-tutorial-maps-markers-and-polygons/

http://www.websofia.com/2013/02/gmap-net-tutorial-maps-markers-and-polygons/