I want to get a Marker instance selecting it from the map.
I found an example in your C# "HowDoSamples", its name is ClickEventOnMarker; the example works fine, so I modified your code to make it more realistic (see below) ; unfortunatly my code does not runs correctly, I am not able to select markers in a stable and reliable manner: sometime the marker is selected and sometime not.
what is wrong ?
change in LabelRotateAMarker_Loaded
//Marker marker = new Marker(-94.558, 39.078);
//marker.ImageSource = new BitmapImage(new Uri("/theme/marker_red_shadow.png", UriKind.RelativeOrAbsolute));
//marker.ImageOffsetX = -28;
//marker.ImageOffsetY = -32;
//markerOverlay.Markers.Add(marker);
double x = -95.558;
for (int i = 0; i < 5; i++)
{
Marker marker = new Marker(x, 39.078);
marker.ImageSource = new BitmapImage(new Uri("/theme/marker_red_shadow.png", UriKind.RelativeOrAbsolute));
marker.ImageOffsetX = -28;
marker.ImageOffsetY = -32;
markerOverlay.Markers.Add(marker);
x = x + 10;
}
change in markerOverlay_MouseLeftButtonUp :
//SimpleMarkerOverlay markerOverlay = Map1.Overlays["SimpleMarkerOverlay"] as SimpleMarkerOverlay;
//Marker marker = markerOverlay.Markers[0];
Marker marker = e.CurrentMarker;