Slugsie
Slugsie

Reputation: 905

Bing Maps WPF control on Winforms, handling click events

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.

Upvotes: 0

Views: 335

Answers (0)

Related Questions