We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Platform: WinForms |
Control: Diagram

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.

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile