UPDATE: Missed that this question was about MapBox. The below is just for the Google maps APIs. I suggest checking out MapBox's docs to see if they allow access to the ZIndex property of the underlying marker.
To set the Z-Order of Markers (where map
is the GoogleMap
instance):
var markerFront = new MarkerOptions();
markerFront.InvokeZIndex(1f); // Set the z-order
markerFront.SetTitle("In Front");
markerFront.SetPosition(new LatLng(lat, lon));
var markerBack = new MarkerOptions();
markerBack.InvokeZIndex(2f); // set the z-order
markerBack.SetTitle("behind");
markerBack.SetPosition(new LatLng(lat-0.0001, lon-0.0001));
map.AddMarker(markerFront);
map.AddMarker(markerBack);
And markerFront
will be above markerBack
. After thedse are set, though, they will be changed by the OS if you click on markerBack
it will be moved to the front. I am not sure if the z-order can be changed after the marker is created, so if you need to keep the z-order when clicking on a marker, I think you would have to remove and re-add the marker with the z-order you want.
I could not find a way (after a very brief search) to change the z-order of the current location marker. Personally I would think you would always want the current location indicator in front anyway.