Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Moving nodes from NodeListView to Diagram (Drop) (Read 2186 times)
wladek
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Jul 20th, 2010
Moving nodes from NodeListView to Diagram (Drop)
Jul 20th, 2010 at 11:10am
Print Post  
I have the following problem. Instead of copying the nodes using copying constructor and drag&drop I would like to move the object from NodeListView to Diagram or at least make a duplicate and then delete the prototype. The problem is that that I cannot intercept the Drop event. Xaml looks like this:
[code]
<diag:Diagram x:Name="diagram"
AlignToGrid="True"
ShowGrid="True"
Bounds="0, 0, 1000, 1000"
NodeCreated="OnNodeCreated"
NodeCreating="OnNodeCreating"
NodeModified="OnNodeModified"
LinkCreated="OnLinkCreated"
ShapeBrush="LightBlue"
DefaultShape="Rectangle"
MouseRightButtonDown="OnDiagramRightDown"
MouseRightButtonUp="OnDiagramRightUp"
AllowDrop="True"
Drop="OnDiagramDrop"/>
[/code]

And the handler simply:
[code]
private void OnDiagramDrop(object sender, DragEventArgs e)
{
     ;
}
[/code]
I assume that In the handler I could do what I want to but I just cannot force the app to handle (fire?) the event.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Moving nodes from NodeListView to Diagram (Dro
Reply #1 - Jul 20th, 2010 at 12:28pm
Print Post  
Our drag-and-drop implementation does not use this Drop event. It seems Drop was added to the base UIElement class with Silverlight 4 and it works only for dragging files from Windows Explorer to a SL control.

The Diagram control will raise NodeCreated in that situation. You could recognize that the new node comes from the NodeListView by setting some property of the listview nodes (e.g. Tag) to a specific value and checking for that value in OnNodeCreated.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
wladek
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Jul 20th, 2010
Re: Moving nodes from NodeListView to Diagram (Dro
Reply #2 - Jul 20th, 2010 at 3:52pm
Print Post  
This approach is the workaround I was working on, but it is still a workaround. Is there a way to modify the built-in behaviour to have the node moved and not copied?

How to switch off the default behaviour? Does it base on MouseUp event?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Moving nodes from NodeListView to Diagram (Dro
Reply #3 - Jul 21st, 2010 at 7:27am
Print Post  
This version adds a DragDropCompleted event:
https://mindfusion.eu/_beta/diaglite18_dragdrop.zip

Code
Select All
private void OnDragDropCompleted(object sender, NodeListViewEventArgs e)
{
	var listView = (NodeListView)sender;
	listView.Items.Remove(e.SourceNode);
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint