Add Items by Double Click

2 posts, 0 answers
  1. Haris
    Haris avatar
    3 posts
    Member since:
    Sep 2017

    Posted 04 Oct 2017 Link to this post

    Hi,

    Can i add shapes from RadDiagramToolbox to RadDiagram by double clicking on the items instead of drag and drop?

     

    Thanks.

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3895 posts

    Posted 04 Oct 2017 Link to this post

    Hello, Haris,  

    Thank you for writing.  

    Note that RadDiagramToolbox is a derivative of RadListView. You can handle its ItemMouseDoubleClick event and add the shape to RadDiagram:
    public RadForm1()
    {
        InitializeComponent();
     
        this.radDiagramToolbox1.ItemMouseDoubleClick += radDiagramToolbox1_ItemMouseDoubleClick;
    }
     
    private void radDiagramToolbox1_ItemMouseDoubleClick(object sender, Telerik.WinControls.UI.ListViewItemEventArgs e)
    {
        DiagramListViewDataItem logicalItem = (DiagramListViewDataItem)e.Item;
        RadDiagramShape shape = new RadDiagramShape();
        shape.Shape = logicalItem.Shape;
        shape.Width = 40;
        shape.Height = 40;
        shape.BackColor = System.Drawing.Color.Yellow;
        this.radDiagram1.AddShape(shape, null, true);           
    }

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Progress Telerik
    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.
Back to Top