Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to move selected nodes by using ArrowKey (Read 3256 times)
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
How to move selected nodes by using ArrowKey
Apr 3rd, 2009 at 7:01am
Print Post  
Hi i am new to WPF.have anybody idea about this ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to move selected nodes by using ArrowKey
Reply #1 - Apr 3rd, 2009 at 8:22am
Print Post  
The arrow keys have some default bindings to change the selection. You can override them to move nodes as shown below:

Code
Select All
diagram.CommandBindings.Add(
	new CommandBinding(Diagram.NavigateLeft, (sender, args) =>
	{
		DiagramNode node = diagram.ActiveItem as DiagramNode;
		if (node != null)
			node.Move(node.Bounds.Left - 10, node.Bounds.Top);
	}));
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: How to move selected nodes by using ArrowKey
Reply #2 - Apr 3rd, 2009 at 9:02am
Print Post  
Hi Stoyan,
i have written this code in the constructor,but its not working.am i missing something?

Thanks,
Anshul
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: How to move selected nodes by using ArrowKey
Reply #3 - Apr 3rd, 2009 at 12:12pm
Print Post  
Hi Stoyan,

This code is working fine only when i select any item and set focus on the diagram, but if i dont focus on the diagram,its not work.
what i want is that,i simply want to select any item than by using arrow key,move any item without focusing on the diagram.

Thanks,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to move selected nodes by using ArrowKey
Reply #4 - Apr 3rd, 2009 at 1:38pm
Print Post  
Try adding a KeyDown handler to the root window.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint