Hi,
I want to know, how can I get child nodes for selected shapes?
For e.g.
A ---> A1-->A3,A4
A ---> A2-->A5,A6
Here A is root with two child's A1,A2.
So if I select A1 then I want to know which shapes are connected (i.e. outgoing links connected shapes from A1).
I want to know, how can I get child nodes for selected shapes?
For e.g.
A ---> A1-->A3,A4
A ---> A2-->A5,A6
Here A is root with two child's A1,A2.
So if I select A1 then I want to know which shapes are connected (i.e. outgoing links connected shapes from A1).
4 Answers, 1 is accepted
0
Lancelot
Top achievements
Rank 1
answered on 16 Jul 2012, 03:40 PM
Hi Shrikant,
You can iterate over the items through items, shapes or connections. After getting a list, you can then look at the list of items and take it from there.
This link will bring you to the documentation on iteration of diagram items. Below is an example of how you would do it:
Good Luck,
Lancelot
You can iterate over the items through items, shapes or connections. After getting a list, you can then look at the list of items and take it from there.
This link will bring you to the documentation on iteration of diagram items. Below is an example of how you would do it:
this
.diagram.Shapes.ToList().ForEach(x =>
{
//your custom logic goes here
(x
as
RadDiagramShape).Content =
"Shape"
;
});
Good Luck,
Lancelot
0
Accepted
Hi Shrikant,
And the connectedShapes will contain the outgoing shapes of the myShape shape. Kind regards,
Miro Miroslavov
the Telerik team
There are some Extensions methods that you can use - GetConnectionsForShape(this IGraph graph, IShape shape) or IEnumerable<IConnection> GetOutgoingConnectionsForShape(this IGraph graph, IShape shape).
So the code will be something like this:
var connectedShapes = diagram.GetOutgoingConnectionsForShape(myShape).Select(c => c.Target);
And the connectedShapes will contain the outgoing shapes of the myShape shape. Kind regards,
Miro Miroslavov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Shrikant
Top achievements
Rank 1
answered on 04 Sep 2012, 11:23 AM
Hi Miro,
In current version of RadDiagram, I didn't found such a method to get connected shapes.
Can you check & tell me.
Thanks
In current version of RadDiagram, I didn't found such a method to get connected shapes.
Can you check & tell me.
Thanks
0
Shrikant
Top achievements
Rank 1
answered on 06 Sep 2012, 08:10 AM
Sorry my mistake, assembly missing - "Telerik.Windows.Diagrams.Core"