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

Custom Shape drop down list

2 Answers 65 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Jacques
Top achievements
Rank 1
Jacques asked on 25 Jan 2019, 08:00 AM

Hi,

I have created a custom RadDiagramShape. I would like to be able to add a drop down list to my shapes so that the user would be able to select a certain value from a list in order to identify each shape. Or some alternative solution which will allow a user to select a value from a drop down list to be able to identify shape objects that are used on the diagram. I've attached an image to try and describe what i would like to achieve.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 28 Jan 2019, 10:46 AM
Hi Jacques,

In this case, you just need a RadHostItem which will allow you to add the drop-down list to the shape. Here is the code:
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
    public RadForm1()
    {
        InitializeComponent();
        var dropdownShape = new DropdownShape()
        {
            Position = new Point(100, 100),
            ElementShape = new RoundRectShape(),
            BackColor = Color.Red
 
        };
        radDiagram1.AddShape(dropdownShape);
 
    }
}
class DropdownShape : RadDiagramShape
{
    RadDropDownList  radDropDownListElement1;
    protected override void CreateChildElements()
    {
        base.CreateChildElements();
        radDropDownListElement1 = new RadDropDownList();
 
        for (int i = 0; i < 10; i++)
        {
            radDropDownListElement1.Items.Add(i.ToString());
        }
 
        var host = new RadHostItem(radDropDownListElement1);
        this.DiagramShapeElement.Children.Add(host);
 
    }
 
}

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jacques
Top achievements
Rank 1
answered on 28 Jan 2019, 12:55 PM

Thank you!

Worked Perfectly

Tags
Diagram, DiagramRibbonBar, DiagramToolBox
Asked by
Jacques
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Jacques
Top achievements
Rank 1
Share this question
or