Articles in this section
Category / Section

How to serialize ConnectionPort with name?

1 min read

Diagram control uses XAML Writer/Reader for serialization purposes while saving, loading, copy, paste, drag and drop from palette. XamlReader.Load cannot be used for deserialization when duplicate name is identified. When you try to do so, a System.Windows.Markup.XamlParseException exception occurs.

To overcome this limitation, don’t specify duplicate names to any VisualElement. When there is any necessity to have duplicate values, you can add custom properties by creating a new class derived from ConnectionPort, Node, etc. This is explained in the following code example.

C#

  //Custom class derived from ConnectionPort
  public class CustomPort : ConnectionPort
  {
       string name;
       public string CustomName
       { 
            get{return name;}
            set{name = value;}
       }
  }

 

 

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