Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Get Shape\Link by Id. (Read 3321 times)
maor
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 79
Joined: Mar 24th, 2009
Get Shape\Link by Id.
Apr 12th, 2009 at 10:35am
Print Post  
Hi,
when i create new shape , i set his unique name.

now i want to get the shape from the diagram by his name.

the function 'Diagram.FindName' do it?

Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get Shape\Link by Id.
Reply #1 - Apr 12th, 2009 at 11:31am
Print Post  
FindName and Name are inherited from FrameworkElement, and this worked fine in my test:

Code
Select All
ShapeNode shapeNode2 = new ShapeNode(diagram);
shapeNode2.Name = "test";
shapeNode2.Text = "FindName test";
shapeNode2.Bounds = new Rect(10, 10, 100, 100);
diagram.Nodes.Add(shapeNode2);

var found = diagram.FindName("test") as ShapeNode;
if (found != null)
	Debug.WriteLine(found.Text);
 



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


I love YaBB 1G - SP1!

Posts: 79
Joined: Mar 24th, 2009
Re: Get Shape\Link by Id.
Reply #2 - Apr 12th, 2009 at 12:14pm
Print Post  
Hi,

Its not work.

Diagram.Nodes[0].Name = "1";
Diagram.FindName("1") - return null.

this method also return shape link?

Thanks

Maor
« Last Edit: Apr 12th, 2009 at 3:25pm by maor »  
Back to top
 
IP Logged
 
maor
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 79
Joined: Mar 24th, 2009
Re: Get Shape\Link by Id.
Reply #3 - Apr 12th, 2009 at 3:25pm
Print Post  
Hi,

Its not work.

Diagram.Nodes[0].Name = "1";
Diagram.FindName("1") - return null.

this method also return shape link?

Thanks

Maor
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get Shape\Link by Id.
Reply #4 - Apr 13th, 2009 at 9:16am
Print Post  
Hi,

Are you calling FindName after saving and loading the diagram? We have not implemented serialization for the name property, so it won't work after calling LoadFromXml.

Stoyan
  
Back to top
 
IP Logged
 
maor
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 79
Joined: Mar 24th, 2009
Re: Get Shape\Link by Id.
Reply #5 - Apr 13th, 2009 at 9:23am
Print Post  
Hi,

What are you mean to saving and loadind the diagram?

when i'm add the nodes to diagram i set tne name property of the node.
after the adding i call to findName to get such shape.

Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint