Articles in this section
Category / Section

How do I programmatically create the symbols defined in a symbol palette file?

1 min read

How do I programmatically create the symbols defined in a symbol palette file?

The Essential Diagram symbol palette file (*.edp file) is a serialized representation of the Syncfusion.Windows.Forms.Diagram.SymbolPalette class, a special type of diagram model that contains a collection of SymbolModel objects. The SymbolPalette can be retrieved from the palette file by deserializing the palette file as shown below,


SymbolPalette palette = null;
FileStream iStream = null;
if (File.Exists(filename))
iStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
SoapFormatter formatter = new SoapFormatter();
formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder;
formatter.AssemblyFormat = FormatterAssemblyStyle.Simple;
System.AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Syncfusion.DiagramBaseAssembly.AssemblyResolver);
palette = (SymbolPalette) formatter.Deserialize(iStream);
catch (Exception ex)
palette = null;
System.AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(Syncfusion.DiagramBaseAssembly.AssemblyResolver);



Dim palette As SymbolPalette = Nothing
Dim iStream As FileStream = Nothing
If File.Exists(filename) Then
iStream = New FileStream(filename, FileMode.Open, FileAccess.Read)
Dim formatter As SoapFormatter = New SoapFormatter
formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder
formatter.AssemblyFormat = FormatterAssemblyStyle.Simple
AddHandler System.AppDomain.CurrentDomain.AssemblyResolve, AddressOf Syncfusion.DiagramBaseAssembly.AssemblyResolver
palette = CType(formatter.Deserialize(iStream), SymbolPalette)
Catch ex As Exception
palette = Nothing
RemoveHandler System.AppDomain.CurrentDomain.AssemblyResolve, AddressOf Syncfusion.DiagramBaseAssembly.AssemblyResolver
End Try
End If


Once the SymbolPalette has been loaded, the SymbolPalette.Nodes property may be used to get hold of the collection of SymbolModels in that palette. SymbolModels serve as the design-time representation of symbols, and the symbol itself can be created using the SymbolModel.CreateInstance() method. The symbol can then be added to the diagram by a) Directly adding it to the diagram's Model.Nodes collection, b) Using the InsertSymbolTool or InsertNodeTool for interactive insertion, or c)Using the InsertNodesCmd for programmatic insertion.

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment