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, copying, pasting, and dragging and dropping from the palette. XamlReader.Load cannot be used for deserialization when a 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 for any VisualElement. When there is a 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  to leave a comment
Access denied
Access denied