How do I serialize custom annotation, as I am not able to serialize using Annotation collection as it only serializes the iAnnotation properties and not extended properties like TEXT.
- Selva Arun asked 7 years ago
- You must login to post comments
Hello Selva Arun
1) ” I set the type of CustomAnnotation to this extendedtype” you mean this MyExtendedCustomAnnotation ? it’s just a name
2) “Do I need to add the extended properties in the above extended class? It still doesn’t serialise.” — if you use Custom annotation and have there your custom properties you have to serialize them manually by yourself. This means you have to convert your properties to string and write it to your writer, something like this ===>>> writer.WriteAttributeString(propertyName, value); and then just read it like
var value = reader[propertyName];
3) If you still have problems with that serialization, you can create a sample app and attach it here, and probably i’ll try to find solution for you.
- Nazariy Pelyushkevych answered 7 years ago
- You must login to post comments
Do I need to add the extended properties in the above extended class? It still doesn’t serialise.
I set the type of CustomAnnotation to this extendedtype.
Please let me know. What else do I need to do?
- Selva Arun answered 7 years ago
- You must login to post comments
Hello Selva Arun,
all annotations including CustomAnnotations are derived from AnnotationBase which implemets an IXmlSerializable interface methods like WriteXml() and ReadXml() all you have to do is to override those methods in your CustomAnnotation
public class MyExtendedCustomAnnotation : CustomAnnotation
{
public override void WriteXml(XmlWriter writer)
{
base.WriteXml(writer);
}
public override void ReadXml(XmlReader reader)
{
base.ReadXml(reader);
}
}
Best Regards,
Pelyushkevych Nazariy
SciChart Wpf\Xamarin developer
- Nazariy Pelyushkevych answered 7 years ago
- last edited 7 years ago
- You must login to post comments
Please login first to submit.