2

I am new to UWP and am using the MapControl. I would like to know if there is any way to get it to respond to the MouseOver (PointerOver for UWP) event. I have a couple of scenarios where I could use this type of information:

  1. I want to allow my users to draw on the map. Therefore, as they are drawing a line, the line could show as the user moves the mouse.
  2. As they move the mouse over the map, I would like to show a cross-hair and textboxes with the current Latitude and Longitude.

Even though I am using UWP to get the app into the Windows store, I am only targeting PCs that would have a mouse. I am not concerned with phones, xbox, etc. for my app.

Thanks for any info you could provide.

iam.Carrot
  • 4,976
  • 2
  • 24
  • 71
Steve0212
  • 682
  • 2
  • 6
  • 23
  • Hey! Did you find any solution to get coords when mouse moves over UWP MapControl yet? Thanks! – NoWar Sep 22 '21 at 09:16

1 Answers1

1

At the moment, the map control does not raise the OnPointerXXX events. You can work around this by putting another transparent XAML element over the map control and registering for Pointer events on that element, but this can cause other issues with events not getting routed properly.

Duncan Lawler
  • 1,772
  • 8
  • 13
  • that is what I ended up doing. Is there any way to get latitude / longitude from the control's x/y coordinates? – Steve0212 Feb 16 '17 at 21:53
  • GetLocationFromOffset will return the location for a given point https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.maps.mapcontrol#Windows_UI_Xaml_Controls_Maps_MapControl_GetLocationFromOffset_Windows_Foundation_Point_Windows_Devices_Geolocation_Geopoint__ – Duncan Lawler Feb 17 '17 at 18:51
  • Ironically, I was on that page and missed that. Exactly what I needed. Thanks. – Steve0212 Feb 18 '17 at 21:30