I would like to know how to iterate through all the elements in a WPF Grid, and then access the absolute positioning values (X, Y) for all of these UIElements.
+1
A:
foreach (UIElement child in grid.Children)
{
MatrixTransform t = (MatrixTransform)child.TransformToAncestor(grid);
Point childLocation = new Point(t.Value.OffsetX, t.Value.OffsetY);
}
Will give you the coordinates of all the direct children relative to the Grid
jesperll
2009-11-13 11:13:10
thanks a lot! thanks a lot!
geejay
2009-11-13 12:50:20
you're welcome :)
jesperll
2009-11-15 19:29:16