-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Passing Rectangle via converter
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.
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