2012-07-16 99 views
0

我正在做一個用戶控件內的橢圓中的rotationTransformscaleTransform。 我已經試過這個,但沒有工作。如何獲得FrameworkElement的真實位置?

Point myUiElementPosition = 
    ellipse.TransformToAncestor(this.Parent as Panel).Transform(new Point(0, 0)); 

我用鼠標旋轉對象,但上面的代碼總是返回相同的值!

我在做什麼錯?我已經試過把App.Current.MainWindow而不是this.Parent as Panel

我也嘗試使用this而不是ellipse

幫助!

+0

你使用RenderTransform還是LayoutTransform? – LPL 2012-07-16 15:30:31

+0

我使用renderTransform。我想它確實有所作爲。 – Seva 2012-07-16 18:55:47

回答

0

使用ellipse.Parent而不是this.Parent。我希望這將有所幫助。

+0

我不知道這是如何工作的。但是轉換是在橢圓內。現在我把它放在主面板裏面,舊的代碼讓這個位置起作用。 = O – Seva 2012-07-16 19:34:46