Issue with drag and drop placement

Dear all,
I’ve a problem with GoXaml, I hope you can help me.
I’ve a palette with a list of node that I can drag and drop in my EntityRelationship user control (taken from demo).
The problem is that when I I drag and drop node in the er user control, node is placed in a different place from mouse dropping point.
That is, I select a point for dropping object but node is placed in another place.
This is method in my window to drag node from palette (that is a datagrid)

private void List_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DataGrid parent = (DataGrid)sender;
dragSource = parent;
object data = GetDataFromListBox(dragSource, e.GetPosition(parent));
if (data != null)
{
DragDrop.DoDragDrop(parent, data, DragDropEffects.Move);
}

    }</b>

In the usercontrol I get dropping point

   <b> private void m_cERModel_Drop(object sender, DragEventArgs e)
    {
        try
        {
            //recupero la posizione di destinazione del mouse
            m_cEndPoint = e.GetPosition((IInputElement)e.Source);
            //recupero l'oggetto sorgente
            object data = e.Data.GetData(typeof(Entity));
            //aggiungo l'oggetto al modello
            OnBtnAdd(data, m_cEndPoint);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        
    }</b>

and I set it into m_cEndPoint.
For adding new node to my model I acted in this way:

            <b>Entity cToData = (Entity)cData;

            cToData.Location = new Point(cEndPoint.X, cEndPoint.Y);

            myDiagram.Model.AddNode(cToData);
            myDiagram.Model.AddLink(cFromData, null, cToData, null);</b>

Node is placed in a different place.
Could you help me?
Thanks

That GetPosition function returns a point in the coordinate system of the element. You need to convert it to the diagram’s model coordinate system, which is different because of scrolling and zooming. Call myDiagram.Panel.TransformViewToModel.

See my discussion in this post: coordinate systems.

ok thanks…it seems to give me an acceptable results (don’t see max precision, but good precision).
What I need know is to know if at that point there is a node, to link my dropping node to note in this point…is there a way to know if given a point in the model there is a node who passes for that point?

Thanks

Do you mean myDiagram.Panel.FindPartAt(p, null, SearchLayers.Nodes)?

But maybe you really mean setting the attached property on your target nodes: go:Part.DropOntoBehavior=“AddsLinkToNode”?