Category / Section
Adding custom properties using property bag
1 min read
Adding custom properties in property bag
We can add custom properties to the node and connector by means of property bag. It can be achieved in two ways:
- Adding custom properties in code behind:
The custom property can be added by invoking the node’s PropertyBag.Add method.
The below code shows how to add custom properties.
[C#]
Syncfusion.Windows.Forms.Diagram.Rectangle rect= new Syncfusion.Windows.Forms.Diagram.Rectangle(10, 10, 10, 10); //Adding Custom Properties for the node in property bag rect.PropertyBag.Add("InnerRect:",10); rect.PropertyBag.Add("OuterRect:", 20);
[VB]
Dim rect As New Syncfusion.Windows.Forms.Diagram.Rectangle(10, 10, 10, 10) 'Adding Custom Properties for the node in property bag rect.PropertyBag.Add("InnerRect:",10) rect.PropertyBag.Add("OuterRect:", 20)
- Adding the custom properties in runtime.
- Add the PropertyEditor in the diagram.
- Select the node to which custom property need to be added.
- Select the propertybag in propertyeditor and enter the Name,Type and Value as shown in the image below.