I created a little test application to look at this control and I'm having a weird issue. I am doing this all programmatically server side. So I added a couple of nodes to the diagram when it starts and then added a button that adds another node to the diagram. If I move the nodes, when the app posts back to add a new node the nodes that were moved revert back to their original position. Is there something else I need to do like capture something on the node moved event?
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
MapDiagram.BorderStyle = BorderStyle.Solid;
MapDiagram.BorderColor = Color.Black;
MapDiagram.Resizable = false;
List<
MapTask
> tasks = MapHelper.GetSampleTasks(4);
AddTasksToMap(tasks);
}
}
private void AddTasksToMap(List<
MapTask
> tasks)
{
foreach (MapTask task in tasks)
{
DiagramShape shape1 = new DiagramShape()
{
Width = 50,
Height = 50,
Type = "rectangle",
X = task.XPosition,
Y = task.YPosition
};
shape1.ContentSettings.Text = task.Description;
MapDiagram.ShapesCollection.Add(shape1);
}
}
protected void BtnAddTaskClick(object sender, EventArgs e)
{
Random r = new Random();
DiagramShape shape1 = new DiagramShape()
{
Width = 50,
Height = 50,
Type = "rectangle",
X = (r.Next(900)),
Y = (r.Next(640))
};
shape1.ContentSettings.Text = "New Task";
MapDiagram.ShapesCollection.Add(shape1);
}