Custom item classes can implement XML serialization for their additional properties by overriding the SaveToXml and LoadFromXml methods. In addition, such classes must specify a string to use as their identifier in the XML document by calling RegisterItemClass.
The control raises SerializeTag and DeserializeTag to enable serialization of complex Id and Tag objects without overriding the item classes. The PropertyName event argument specifies which property is being serialized.
Custom item classes can implement JSON serialization for their additional properties by overriding the SaveToJson and LoadFromJson methods. Such classes must be registered for serialization by calling the RegisterItemClass method and providing a string identifier for the clientClass parameter.
The control raises JsonSerializeTag and JsonDeserializeTag to enable serialization of complex Id and Tag objects without overriding the item classes. The PropertyName event argument specifies which property is being serialized.
JSON serialization is handled internally by the classes from MindFusion.Json namespace. The JsonValue class represents a property value. Property names and values are stored in instances of the JsonObject dictionary class. The JsonContext class handles the serialization of the Diagram properties. The Serialize method is a wrapper over the Serializer class' Serialize method. It takes a JsonObject and serializes it to a string. The Parse method is a wrapper over the Parser class' ReadJsonObject method. It takes a JSON-formatted string and returns a JsonObject with the parsed data.
You can create a static image representing the current diagram using the CreateImage method. The method returns a Microsoft.Maui.Graphics.IImage instance. Alternatively, call ExportImage to export the diagram to a bitmap file.