This is a migrated thread and some comments may be shown as answers.
Custom shape with model
3 Answers 20 Views
This is a migrated thread and some comments may be shown as answers.
Tino
Top achievements
Rank 1
Tino asked on 25 May 2018, 06:30 AM

What's the easiest way to get a custom shape based on a rectangle, to draw a model object?

For example, if this is a dummy model object

class model
{
    public string text { get; set; }
    public int x { get; set; }
    public int y { get; set; }
    public int width { get; set; }
    public int height { get; set; }
}

 

I want to display these objects using a custom shape that is just a white rectangle with a black border, programmatically. Please give a short sample.

 

 

 

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 25 May 2018, 09:34 AM
Hello, Tino,    

By default, when you bind RadDiagram, RadDiagramShape items are created by the DiagramDataLayer. It would be nice to have the possibility to replace the DiagramDataLayer for example and override its CreateDiagramShapeItem method to use custom RadDiagramShapes. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to use unbound mode and add your custom shapes considering the data stored in the model's records.

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Tino
Top achievements
Rank 1
answered on 27 May 2018, 10:02 PM
Hi, this question is already about unbound mode (programmatic). Thanks.
0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 28 May 2018, 11:48 AM
Hello, Tino,    

If you need to add custom shapes in RadDiagram, it is necessary to create a derivative of the RadDiagramShape class. Create the desired properties and implement the desired custom logic you need in the custom shape. Then, in order to add the custom shapes programmatically in unbound mode, it is just necessary to create an instance of the custom shape, extract the necessary information from the Model object you have and add the shape by using the RadDiagram.AddShape method passing the shape instance as a parameter. The following help article demonstrates how to create a custom shape and add it to the diagram: https://docs.telerik.com/devtools/winforms/diagram/custom-shapes

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Tino
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Sr.
Telerik team
Tino
Top achievements
Rank 1
Share this question
or