Graphics Layer always on top

3038
2
10-07-2015 11:28 AM
EricPaitz
Esri Contributor

We have a need to show several point, line, and polygon graphics layers on the map that are also visible in the legend. In the WPF API this was done with the GraphicsLayer. The issue is that we need these GraphicsLayers to always be on top of all other layers. Our application allows the user to add layers on the fly (like KML, SHP, MapServices, etc), thus after a user adds a layer we need these GraphicsLayers to be on top of the newly added layer. Now with the .NET API we were going to use the MapView.GraphicsOverlays with a GraphicsOverlay because the API will keep these layers on top of all other layers (which is perfect) but it says that these layers are not visible to the legend.

Can someone offer a simple suggestion for keeping a GraphicsLayer always on top of all other layers during the lifetime of the application?

As an enhancement request

1.) By default do not show a GraphicsOverlay in the legend but have a property that can be set that would allow it to be visible to the legend.

2.) (or) Add logic to the GraphicsLayer class that would keep it on top. Maybe a bool property like GraphicsLayer.IsAlwaysOnTop that is false by default.

Thanks,

   -eric

0 Kudos
2 Replies
HuyHo
by
Occasional Contributor

Our application has a similar requirement -- We did not use the GraphicsOverlay because it wasn't available at the time of implementation.  But we we basically did is have custom codes that moves the graphic layers to the top of the stack whenever a layer is added.  You should be able to access the layers and manipulate it in the MapView.Map.Layers collection.

EricPaitz
Esri Contributor

Yes in our WPF Runtime application we did something similar. In our newer .NET Runtime application we have an AggregateEvent from Prism that handles all the Events. We have an event called AddLayerEvent that is managed by one ViewModel so anytime a layer needs to be added to the map it goes through this event. The order of the layers can be managed in this central place as they are added.

0 Kudos