wpf - Winforms上的Bing Maps WPF控件,处理点击事件
问题描述
我正在尝试将 Bing 地图集成到现有的 VB.Net winforms 应用程序中。我遵循了 Ricky Brundritts 指南(https://rbrundritt.wordpress.com/2012/01/05/using-bing-maps-in-winforms/)并创建了一个 WPF 用户控件并将其托管在 ElementHost 中。到目前为止一切顺利,地图显示在我的 winform 中,我可以与之交互(拖动、缩放等)。我可以将 PushPins 添加到地图 OK:
Dim Layer As New MapLayer()
MyMapUserControl.Map.Children.Add(Layer)
Dim pin As New Pushpin() With _
{
.Location = New Location(0, 0),
.Background = New System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Magenta),
.ToolTip = "This is a test tooltip",
.Content = "X"
}
AddHandler pin.MouseLeftButtonUp, AddressOf PushPinMouseUp
Layer.Children.Add(pin)
图钉正确显示,但它不会对鼠标单击做出反应,即永远不会调用 PushPinMouseUp 方法。
我错过了什么?
编辑
我发现我可以检测到对 pin 的双击:
AddHandler pin.MouseDoubleClick, AddressOf PushPinMouseDoubleClick
所以至少有一些事件是有效的,但不是 MouseLeftButtonUp。
解决方案
推荐阅读
- java - 执行简单 SPRING MVC 示例时出现异常严重:子容器在启动 java.util.concurrent 期间失败
- typescript - 在 Promise 库上创建一个通用接口
- javascript - javascript中的类追加和删除
- node.js - 在流星中完成页面加载后如何调用函数?
- unity3d - 如何使用 UnityWebRequest 在 Unity 中编写 HTTP 发布请求?
- java - 我无法将 Tomcat webapp 配置为能够在 Eclipse 上进行调试
- ssh - GitLab.com 配置文件上的备用 SSH 连接
- javascript - 在节点模块中导入 Typescript 和 Js 文件的问题
- java - SQLite 驱动程序不适合
- python - 我的程序只计算最后一个值