How does one get the upper left coordinates of a framework elements bounding rectangle?
let fe : FrameworkElement = ea.Item.Content
let p = fe.TranslatePoint(new Point(0.0, 0.0), null)
The preceding code is giving me: The field, constructor or member 'TranslatePoint' is not defined. I am confused as MSDN Shows this as a memeber of FrameworkElement inherited from UIElement:
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement_members(v=VS.100).aspx
Use element.TranslatePoint(new Point(0.0, 0.0), null)
to get the upper left coordinates of element
relative to the logical root element. If you want it relative to another element, specify it at the second parameter instead of null
. You can then use ActualWidth
and ActualHeight
to compute the whole rectangle.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.