Hello Ramya,
I did some further testing and found that I can only reproduce the naming issues if I first call diagram.Model.Clear() or diagram.Model.RemoveAllChildren() prior to adding/appending all of the nodes. See the code snippet below:
using System;
using System.Drawing;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Diagram;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
LoadDiagram();
}
private void LoadDiagram()
{
// Calling either of these methods first causes the ControlNode naming issues
diagram1.Model.Clear();
//diagram1.Model.RemoveAllChildren();
// Nodes are renamed "1", "2", "3" after appended, unexpected
AddNode("49070");
AddNode("49071");
AddNode("49072");
// Nodes are renamed "a1", "b1", "c1" after appended, also unexpected
AddNode("a");
AddNode("b");
AddNode("c");
}
private void AddNode(string name)
{
var control = new Button();
var rectBounds = new RectangleF(0, 0, 270, 170);
var node = new ControlNode(control, rectBounds)
{
Name = name
};
Console.WriteLine("Node name before append: " + node.Name);
diagram1.Model.AppendChild(node);
Console.WriteLine("Node name after append: " + node.Name);
}
}
}
The console output is this:
Node name before append: 49070
Node name after append: 1
Node name before append: 49071
Node name after append: 2
Node name before append: 49072
Node name after append: 3
Node name before append: a
Node name after append: a1
Node name before append: b
Node name after append: b1
Node name before append: c
Node name after append: c1
Regards,
Mark