How do I get the real position of a FrameworkElement?
-
21-06-2021 - |
题
I am doing rotationTransform
and scaleTransform
in a ellipse which is inside a usercontrol.
I already tried this, but didn't work.
Point myUiElementPosition =
ellipse.TransformToAncestor(this.Parent as Panel).Transform(new Point(0, 0));
I'm using the mouse to rotate the object, but the code above always return the same value!
What am I doing wrong? I already tried to put App.Current.MainWindow
instead of this.Parent as Panel
.
I also tried using this
instead of ellipse
.
Help!
解决方案
use ellipse.Parent
instead of this.Parent
. I hope this will help.
不隶属于 StackOverflow