Select to view content in your preferred language

Symbol by code

474
1
08-08-2012 04:27 AM
EricROHEL
New Contributor
Is there a way to create a marker symbol by code on Graphics layers?
today i use the xaml code, and it works fine:

....<Path Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z " Fill="#FF333333"....

but i have so many differrent kind of symbols, depending sometime on variable, that i am looking for the symbol creation via code with a path data or equivalent.

any help is welcome.
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
You can create a custom symbol that inherits from MarkerSymbol and add an enum property for Style. You can define your symbol templates as resource and choose the appropriate one based on Style. If you want to build the ControlTemplate itself in code, I think you can follow this approach: http://blogs.silverlight.net/blogs/msnow/archive/2008/10/09/silverlight-tip-of-the-day-60-how-to-loa.... So create a default template string and use string.Format() to replace Path, then use XamlReader.Load to set ControlTemplate.
0 Kudos