Hi,
We are trying to serialize the WPFMap control,
we are getting the following errors and we will be grateful if you take a look on it and help us to solve them.
First I tried to Serialized the ThinkGeo.MapSuite.DesktopEdition.WpfMap directly using the below code(I tested soap formatter too):
ThinkGeo.MapSuite.DesktopEdition.WpfMap MyWPF = new ThinkGeo.MapSuite.DesktopEdition.WpfMap();
FileStream fs = new FileStream(@"c:\\SerializedDate3.Data", FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, MyWPF);
fs.Close();
But I received the below error:
Type 'System.Windows.Controls.Canvas' in Assembly 'PresentationFramework, Version=X.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.
Then I tried to sterilize the properties of the control:
FileStream fs = new FileStream(@"c:\\SerializedDate2.Data", FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, wpfMap1.Overlays);
fs.Close();
But I received another error:
Type 'System.IO.FileStream' in Assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Now I’m trying to create my classes based on the ThinkGeo.MapSuite.DesktopEdition.WpfMap properties and the serialized/desterilized them, but I’m not sure this way will work for all properties and it will not make unpredicted problems.
Any ideas on how to solve this would be great
Thanks