"Serialize" a DependencyObject
In my previous post, I mentioned that my biggest gripe with deriving from DependencyObject is that it is not serializable! I stand corrected (Well, almost).
This is the code I tried initially
BinaryFormatter serializer = new BinaryFormatter();
serializer.Serialize(stream, Assesments);
And here is my exception
Type 'MyHealth.Model.AssesmentCollection' in Assembly 'MyHealth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
To solve this problem, I tried the XamlWritter & XamlReader, here is the code
XamlWriter.Save(Assesments, stream);
THIS WORKED!!!
And now the code is plain and simple...
Download the newest version of myHealth at CodePlex
If you found this article useful, please 