Custom Shape drop down list

3 posts, 0 answers
  1. Jacques
    Jacques avatar
    4 posts
    Member since:
    Jan 2019

    Posted 25 Jan Link to this post

    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. Dimitar
    Admin
    Dimitar avatar
    2798 posts

    Posted 28 Jan Link to this post

    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.
  3. Jacques
    Jacques avatar
    4 posts
    Member since:
    Jan 2019

    Posted 28 Jan in reply to Dimitar Link to this post

    Thank you!

    Worked Perfectly

Back to Top