This project has moved. For the latest updates, please go here.

zindex

Jun 18, 2013 at 9:08 PM
Hi Clemens,

I´m adding MapPolylines and some shapes I derived from MapPath class to a map.
How could I control the zindex of those items on the map?

Thanks,
Fernando.
Coordinator
Jun 19, 2013 at 6:10 AM
Edited Jun 19, 2013 at 6:12 AM
Hi Fernando,
this is a good question, as it pointed me to a problem in the Map Control.

In order to control the z index of elements on the map, you would usually set the Panel.ZIndex attached property, as with any other WPF elements contained in Panels (like e.g. Shapes in a Canvas). This also works with the Map Control, as long as you put your MapPolylines and MapPaths in a separate MapPanel like this:
<map:MapPanel>
    <map:MapPolyline x:Name="p1" IsClosed="True" Fill="AliceBlue"/>
    <map:MapPolyline x:Name="p2" IsClosed="True" Fill="LightBlue" Panel.ZIndex="1"/>
    <map:MapPolyline x:Name="p3" IsClosed="True" Fill="SteelBlue"/>
</map:MapPanel>
However, it doesn't work when you put the elements directly on the map, although Map is also a MapPanel. Now I've found the reason for this behaviour and fixed it. I'm going to release that fix very soon. Until then you may just use an additional MapPanel as shown above.
Jun 19, 2013 at 4:29 PM
Thanks Clemens,

Added my items to a MapPanel within the map and now zindexing is working perfectly.

Regards,
Fernando.
Coordinator
Jun 19, 2013 at 5:17 PM
I've just released the newest version 1.3.7, where z index also works directly in the Map control.
I also re-enabled the possibility to set the MapPolyline.Locations property in XAML, which was disabled by accident in some earlier version.
Have fun!