anderZubi
anderZubi

Reputation: 6424

Map is capturing Tap events from MapItemsControl elements

I have a Bing Map control in my Windows Store app. I use the Tapped event of the map to place a Pushpin on the selected location.

My map also contains a MapItemsControl with some clickable elements. Actually, they're some pushpins that show a popup when clicked.

The problem is that when I click in any of these pushpins, the Map's Tapped event is also fired.

I have also noticed that when this happens all the elements are rendered again, producing a strange behavior on the visual elements.

Any idea why this is happening, and how can I avoid the Map capturing the Tapped event if the Tap has happend on other element?

Upvotes: 0

Views: 169

Answers (1)

rbrundritt
rbrundritt

Reputation: 17974

In your tap event handler for your pushpin tell the event that it has been handled like this:

Pin.Tapped += (s,e)=>{
    e.Handled = true;
};

This should stop it from bubbling through to the map.

Also, if you want to only let the user add pushpins on the map when they enable the functionality, you can add and remove the tap event as well.

Upvotes: 1

Related Questions