0

I'm trying to integrate Bing maps into an existing VB.Net winforms application. I've followed Ricky Brundritts guide (https://rbrundritt.wordpress.com/2012/01/05/using-bing-maps-in-winforms/) and created a WPF user control and hosted it inside an ElementHost. So far so good, the map shows up inside my winform and I can interact with it (drag, zoom etc). I can add PushPins to the map 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)

The pushpin shows up correctly, but it doesn't react to mouse clicks, i.e. the PushPinMouseUp method is never called.

What am I missing?

EDIT

I've found that I can detect a double click on a pin:

AddHandler pin.MouseDoubleClick, AddressOf PushPinMouseDoubleClick

So at least some of the events are working, but not MouseLeftButtonUp.

Slugsie
  • 851
  • 1
  • 7
  • 17
  • Use the `MouseDown` event. Can you show the signature of `PushPinMouseUp`...? – Trevor Nov 21 '18 at 01:14
  • OK, `MouseDown` works fine, `MouseUp` doesn't. The stubs for each were generated automatically: `Private Sub PushPinMouseUp(sender As Object, e As Windows.Input.MouseButtonEventArgs)` – Slugsie Nov 21 '18 at 09:52
  • Additionally, while `DoubleClick` works, it seems to grab and hold the mouse until the user performs another click. – Slugsie Nov 21 '18 at 09:54
  • Just noticed that `MouseUp` does work for Middle and Right buttons, but not for Left. Weird. – Slugsie Nov 21 '18 at 09:59

0 Answers0