Hi all,
I am using a Custom TreeView (whit custom item style) bound to an ObservableCollection. I have a function that walks the tree and calculates/stores items' coordinates with the purpose of drawing some custom shapes over the tree. It uses something like this:
(...)
FrameworkElement grid = VisualTreeHelper.GetChild(currentParent, 0) as FrameworkElement;
Point centerPoint = grid.TranslatePoint(new Point(grid.ActualWidth / 2, grid.ActualHeight / 2), myTreeView);
(...)
I use two buttons (move up, move down) to change the order of the items in their collection and I see the tree items correctly updated BUT custom shapes positions are updated incorrectly.
My problem is that if I calculate coordinates of items just after the move operation I get OLD coordinates, it seems that the tree real arrangement happens after my calculations. This way my shapes use always coordinates one step older.
I tried to calculate coordinates inside ArrangeOverride function of my TreeView, but seems that it never gets called after the move operation, and even if I force an InvalidateArrange() the coordinates returned are old.
What is the right way of getting fresh coordinates of items in a treeview after a move?
Thanks in advance, Paolo