Page 1 of 1

Visual::TranslatePoint and TransformToXXX

Posted: 14 Aug 2023, 10:09
by ulisesBB
Hi there! I was trying to convert coordinates from 1 visual to another, in C# I can use the TranslatePoint method (which in C++ doesn't exist) or the TransformToAncestor/TransformToVisual which returns a Transform that I can use. But in C++, TransformToXXX methods return a Matrix4 object and I can't see any way to transform a Point using it.

Could you tell me if I am going through a wrong direction here? I am quite new to XAML so maybe there is another way of transforming coordinates.

Thanks,

Re: Visual::TranslatePoint and TransformToXXX

Posted: 14 Aug 2023, 14:23
by ulisesBB
Ok! I realized i was able to do the translation using Visual::PointToScreen with the new local position and Visual::PointFromScreen using the target element.
Still, I think those methods should be implemented in C++.

Cheers,

Re: Visual::TranslatePoint and TransformToXXX

Posted: 14 Aug 2023, 17:03
by sfernandez
i was able to do the translation using Visual::PointToScreen with the new local position and Visual::PointFromScreen using the target element
Yes, that allows transforming points from/to screen for a target element.
Still, I think those methods should be implemented in C++.
It can be useful indeed. Could you please report it in our bugtracker and we will add the TranslatePoint method to the UIElement.