This is a migrated thread and some comments may be shown as answers.

Get coordinates of a given RadTreeViewItem

1 Answer 79 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Lauren Nickerson
Top achievements
Rank 1
Lauren Nickerson asked on 11 Feb 2010, 08:06 PM
Hi, I'm trying to figure out how to do this. Is there a method or a property that returns the X and Y coordinates of an item?

Thanks!

EDIT:

I need the coordinates relative to the parent of the RadTreeView and relative to the RadTreeView itself.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 12 Feb 2010, 02:49 PM
Hello Lauren,

You can get the corrdinates relative to the parent by using this:

GeneralTransform generalTransform = childElement.TransformToVisual( parentElement );
Point childToParentCoordinates = generalTransform.Transform( new Point( 0, 0 ) );


Alternatively, you can get the absolute coordinates like so:

GeneralTransform generalTransform = childElement.TransformToVisual( null );
Point childToParentCoordinates = generalTransform.Transform( new Point( 0, 0 ) );


Greetings,
Tihomir Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
Lauren Nickerson
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Share this question
or