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;
}
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?
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.
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.
Thank you for the clarification, Dominique. I'll work on the solution you suggested.