Setting the x and y location of a dragged item


#1

I found a great blog for drag and drop in nativescript (https://codetolight.wordpress.com/2017/04/10/dragging-and-dropping-ui-elements-in-nativescript-with-basic-collision-detection/), but I cannot figure out how to set an absolute x and y value for an element. I want an element to stick to another element, so essentially have the identical x and y of the element that gets dropped on. I see translateX and translateY move the element, but how do set the x and y to something specific?


#2

If you are using AbsoluteLayout you can set left (x) and top (y) coordinates.


#3

Yeah, that works if the container is an absolute layout. It would be nice if I could use a grid, but I guess I’ll figure it out.