3.2 Feature Layer Graphic Symbol Null

3275
6
06-26-2014 11:59 AM
dmacq
by
New Contributor III
In the Updated event of a given feature layer, I'm applying a custom control template to the symbol of each graphic.  In 3.2, the symbols of each graphic are null, which was not the case in 3.1.  I've set RendererTakesPrecedence to false, and have set the Renderer to null with no luck. 

Anyone else notice this? Any ideas?
0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
I am not sure what you want to do exactly.

Most generally the symbology is based on a renderer, in this case, for changing the symbology, you have to change the symbols used by the renderer.

On the other hand, if you want to set a particular symbol by graphic you have to set it manually then Graphic.Symbol should return this symbol.
0 Kudos
dmacq
by
New Contributor III

I'm trying to apply a custom control template to the existing symbol of a graphic.  For instance, I have a construction area layer that is yellow with a gray border.  When a user mouses over an individual construction area, the border gets thicker and the opacity goes from .5 to 1, giving it an interactive "feeling".

I've accomplished this with no issues in 3.1 by applying a control template dynamically to the symbol of this and many other features. In 3.2, when trying to access the symbol of any graphic, it is null, so I can no longer apply my control template.

ControlTemplate ct = MyFeatureControlTemplate(fLayer);

foreach (Graphic g in fLayer.Graphics)

{

    if(g.Symbol != null)

        g.Symbol.ControlTemplate = ct;

}

0 Kudos
DominiqueBroux
Esri Frequent Contributor

If your symbology is defined by a renderer, you have to change the symbol of the renderer.

If your symbology is defined by graphic, you should be able to get the symbol from the graphic and modify it.

How is defined your symbology?

0 Kudos
dmacq
by
New Contributor III

The symbology is defined in the service (in the mxd).  I'm not changing the symbol, just how it behaves, if that makes sense.

Regarding the code I posted above.  With 3.1, g.symbol is not null, and contains the specific symbol information for each graphic.  In 3.2, g.symbol is null.

0 Kudos
DominiqueBroux
Esri Frequent Contributor

Oh I see. It was actually a bug in 3.1. In 3.1, the symbols coming from the renderer were also stored by the graphics.

The issue was that any change in the renderer was ignored since the symbols were froozen by graphic.

This has been fixed in 3.2 so graphic.Symbol is always null but it has been set explicetly.

So in your case, the solution should be to get the renderer of your feature layer and change (or update) the symbols of the renderer.

0 Kudos
dmacq
by
New Contributor III

Thank you for the clarification, Dominique.  I'll work on the solution you suggested.

0 Kudos