Select to view content in your preferred language

Serialize GraphicsLayer

3389
10
06-09-2010 07:24 AM
RyanCoodey
Regular Contributor
So I have tried to serialize a GraphicsLayer, a GraphicCollection and just a Graphic itself.  I have tried using XmlSerializer, DataContractSerializer and DataContractJsonSerializer... all of which give some sort of error.

I want the users to be able to save any graphic markup they have made on the map, so I want to serialize them... is there no way to do this?

Thanks a lot!

*EDIT*  Also, I read the article: http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2010/03/11/Sending-geometry-between-Silverlig..., but don't want/need it sent to the server... it just needs to be saved for that one user
10 Replies
dotMorten_esri
Esri Notable Contributor
I know this is an old thread, but in case some one else ends up here, recent versions of the Silverlight API allows you to use FeatureSet.ToJson() to do quick easy serialization.
For a more low level approach, take a look at the Json classes used in this sample: http://www.arcgis.com/home/item.html?id=6d28a606369c43fd9a6f929541ae7c93 (note that this converts from a different geometry type, but the json writing approach is very similar)
0 Kudos