I have created a mutiple grids dynamically and added them to a canvas control. Once they have been added I allow them to be dragged and dropped around the canvas. My current problem is that I would like to no retrieve the new position of the control so I
can store the new x and y co-ordinates in a database and on the next loading of the page, display them in the new position. Can anyone help me with this?
this is my current code but it doesn't work:
foreach (Grid child in this.dragCanvas.Children)
{
// Return the offset vector for the object.
Vector vector = VisualTreeHelper.GetOffset(child.Name);
// Convert the vector to a point value.
Point currentPoint = new Point(vector.X, vector.Y);
double left = currentPoint.X;
double top = currentPoint.Y;
double z;
}
Any help will be appreciated.