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