User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Passing Rectangle via converter

02 Sep 2021, 18:47

It's weird because PointToScreen is internally implemented using the same code as TransformToAncestor.

And just some hints, element->GetParent() returns the logical parent, which will be null on the root of a DataTemplate or ControlTemplate, so it won't be useful when used inside the elements of a template. To walk up the visual tree you should be using VisualTreeHelper::GetParent(visual) (or if you need to get to the root, VisualTreeHelper::GetRoot(visual)).
And if you need to find a named element in the UI tree you can just call element->FindName(targetName) instead of climbing up the tree.

Who is online

Users browsing this forum: No registered users and 83 guests