2

I have a layer with a number of polygons, where the layer is marked as NOT being an infolayer

myLayer = new Layer() { IsMapInfoLayer = false...

I also have an eventhandler for clicking the map defined in the xaml

MapClicked="myClickHandler"

This click works well on empty areas, but if I click a polygon, the map click is blocked. Previously I solved this by responding to the info event handler for the polygons and route that to the same code that handled map clicks, but that is not enough now, as I need the lat,lng of the clicked position.

How do I make the polygons not intercept my click?

JoeTaicoon
  • 1,383
  • 1
  • 12
  • 28
  • Would you mind sharing us a baisc, minimal project to test ? You can upload it to github and attach the link here. – Wen xu Li Oct 28 '21 at 09:42
  • I assume that this means you cannot reproduce easily? I am pretty sure I saw the same behavior previously in an early test app... same as the long press on a map never working for me either. I will see what I can do. – JoeTaicoon Oct 28 '21 at 14:24
  • You say IsMapInfoLayer is false. This means no MapInfo event should be triggered from that layer. Is this what you see? Or do you get a MapInfo event anyway? If so, this is a bug. Or do you get no event at all in that case? If so this is also a bug. Or do you get a MapInfo event for another layer and no MapClicked? In that case it is by design. – pauldendulk Oct 29 '21 at 08:57
  • I see no info event if layer is non info, but I also do not see a map clicked event, as the polygon still blocks the click. Only difference is that ifInfo I get an info event on click while if notInfo I get neither a map click or an info click. If I click outside the polygons, I get mapclicks. – JoeTaicoon Oct 29 '21 at 14:15

1 Answers1

0

If a feature is clicked the MapInfo event is called. If not the MapClicked event is called. This is by design. You mention IsMapInfoLayer is set to false. In that case no MapInfo event should be triggered and you should get a MapClicked event. Note, that the MapInfo event could also be triggered from another layer.

A workaround for your problem: The MapInfo event also contains the WorldPosition but it is on SphericalMercator coordinates. You can translate that with:

var latLon = Projection.SphericalMercator.ToLonLat(point.X, point.Y);

pauldendulk
  • 1,378
  • 12
  • 23
  • Thanks. I actually noticed the world coordinate in the info after posting the question, but forgot to update. The real question stands, though, which is why the polygons block map clicks even when they are in a nonInfo layer and even if the handled property of the info event is set false (or true). – JoeTaicoon Oct 27 '21 at 18:43