Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Can we navigate through Nodes using "Tab" (Read 1712 times)
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Can we navigate through Nodes using "Tab"
Aug 5th, 2010 at 9:11am
Print Post  
Hi,
You know well about TabIndex property of a control. Do WPF Diagram nodes has similar property?

How can I achieve it?
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Can we navigate through Nodes using "Tab&
Reply #1 - Aug 5th, 2010 at 10:16am
Print Post  
Hi,

They don't. You might define yours as attached property and then implement tabbing as shown below.

Code
Select All
diagram.CommandBindings.Add(
	new CommandBinding(EditingCommands.TabForward, OnTabForward));
diagram.InputBindings.Add(
	new InputBinding(EditingCommands.TabForward, new KeyGesture(Key.Tab)));

private void OnTabForward(object sender, ExecutedRoutedEventArgs e)
{
	int numNodes = diagram.Nodes.Count;
	if (numNodes == 0)
		return;

	var currentNode = diagram.ActiveItem as DiagramNode;
	if (currentNode == null)
	{
		diagram.ActiveItem = diagram.Nodes[0];
		return;
	}

	int next = (diagram.Nodes.IndexOf(currentNode) + 1) % numNodes;
	diagram.Selection.Change(diagram.Nodes[next]);
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Can we navigate through Nodes using "Tab&
Reply #2 - Aug 5th, 2010 at 12:20pm
Print Post  
Thanks. Lemme try it and get back to you.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint