This is a migrated thread and some comments may be shown as answers.

how to Get RadDiagramShape by its name in c#?

1 Answer 107 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Sachin
Top achievements
Rank 1
Sachin asked on 23 May 2017, 08:20 AM

I am working on a project in which RadDiagramShape is generated dynamically in foreach loop.

 

I need to change text of each Shape at each second. For that i need to access the Shape object by its name property which is unique. 

 

How to i get RadDiagramShape object by its name?

 

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 23 May 2017, 04:02 PM
Hi Sachin,

Thank you for writing.

The shapes are stored in a ShapeCollection object which is exposed by the RadDiagram.Shapes property. The ShapeCollection class inherits the System.Collections.ObjectModel.ReadOnlyCollection<T> class which cannot be enumerated by name.

I can suggest to iterate your collection and search for the shape by its Name or use LINQ: 
var shape = this.radDiagram1.Shapes.Where(s => s.Name == "YourName").FirstOrDefault();

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Diagram, DiagramRibbonBar, DiagramToolBox
Asked by
Sachin
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or