Graphics Priority

1261
2
Jump to solution
07-26-2019 12:04 AM
GonzaloMuöoz
Occasional Contributor

Is there anyway to set layers or graphics priorities? With priorities I mean that in case of overlapping, set a priority of being on top to some certain type of graphics / layers?

0 Kudos
1 Solution

Accepted Solutions
ThadTilton
Esri Contributor

Hi Gonzalo,

The `GraphicsOverlays` collection also has methods to manage the order of the `GraphicsOverlays` it contains (Add, Insert, Move, Remove, etc.).

Within a `GraphicsOverlay`, you can also set a z-index property on individual graphics. A larger z-index means the graphic is higher in the draw order (for graphics in the same overlay).

bottomGraphic.ZIndex = 0;
topGraphic.ZIndex = 1;‍‍

Note: Graphics overlays *always* draw on top of layers in the map. 

Thad

View solution in original post

2 Replies
JoeHershman
MVP Regular Contributor

With Layers it is based on order added to the Layers collection, last in is on top.  So index zero is on top, I would assume GraphcsOverlay is the same but I have never had a case of overlap with graphics to confirm that.  OperationalLayers has an Insert method, so you put layers in a specific order instead of just using Add

Thanks,
-Joe
ThadTilton
Esri Contributor

Hi Gonzalo,

The `GraphicsOverlays` collection also has methods to manage the order of the `GraphicsOverlays` it contains (Add, Insert, Move, Remove, etc.).

Within a `GraphicsOverlay`, you can also set a z-index property on individual graphics. A larger z-index means the graphic is higher in the draw order (for graphics in the same overlay).

bottomGraphic.ZIndex = 0;
topGraphic.ZIndex = 1;‍‍

Note: Graphics overlays *always* draw on top of layers in the map. 

Thad