User avatar
ulisesBB
Topic Author
Posts: 2
Joined: 14 Aug 2023, 10:04

Visual::TranslatePoint and TransformToXXX

14 Aug 2023, 10:09

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,
 
User avatar
ulisesBB
Topic Author
Posts: 2
Joined: 14 Aug 2023, 10:04

Re: Visual::TranslatePoint and TransformToXXX

14 Aug 2023, 14:23

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,
 
User avatar
sfernandez
Site Admin
Posts: 3109
Joined: 22 Dec 2011, 19:20

Re: Visual::TranslatePoint and TransformToXXX

14 Aug 2023, 17:03

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.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests