MarkerSymbol dynamic stroke color

729
4
01-22-2014 10:52 AM
LuisGarcia2
Occasional Contributor II
I am working in a project where we have to define the stroke color of a SimpleMarkerSymbol. Right now I am using a ControlTemplate to define it like this:

<ControlTemplate> 
<Ellipse Fill="{Binding Symbol.Color}" Stroke="Black" />
</ControlTemplate>


That worked fine until now. I have an enhancement request that asks to make the Stroke color dynamic like the Fill color is. For the Fill color to be dynamic what I did was to Bind it to the "Color" property of the "SimpleMarkerSymbol." That works fine except that I don't see any Stroke property in the SimpleMarkerSymbol class.
How can I add that? Do I need to write my own MarkerSymbol class? I tried extending SimpleMarkerSymbol but that is a "sealed" class.
Thanks for your help!
0 Kudos
4 Replies
DominiqueBroux
Esri Frequent Contributor
You are righ SimpleMarkrSymbol is not meant for subclassing.
You have to subclass MarkerSymbol and define the Dependency Properties you need.

One easier, but not supported, way to do it is to use the internal ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleMarkerSymbol which has OutlineColor and OutLineThickness properties.
0 Kudos
LuisGarcia2
Occasional Contributor II
Thanks for your reply. Yeah, I figured I would have to extend MarkerSymbol. I see in the documentation that SimpleMarkerSymbol extends MarkerSymbol AND IJsonSerializable. What is this IJsonSerializable interface for? Do you know if I need to extend that as well in my project for it to work properly?
Also, you mentioned this other SimpleMarkerSymbol class in ESRI.ArcGIS.Client.FeatureService.Symbols, what is the difference between that class and the one I am using?
Thanks!
0 Kudos
DominiqueBroux
Esri Frequent Contributor
What is this IJsonSerializable interface for? Do you know if I need to extend that as well in my project for it to work properly?

The IJsonSerializable interface is mainly for being able to print the graphics at server side.
Without implementing this interface, the graphics using your symbol will be printed with a default symbol.

Also, you mentioned this other SimpleMarkerSymbol class in ESRI.ArcGIS.Client.FeatureService.Symbols, what is the difference between that class and the one I am using?

ESRI.ArcGIS.Client.FeatureService.Symbols is used internally to create symbols for feature services.
0 Kudos
LuisGarcia2
Occasional Contributor II
Dominique,
thanks again. Is there any example somewhere about the ToJason method and how to write it?
Thanks!
Luis
0 Kudos