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

Add Items by Double Click

1 Answer 76 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Haris
Top achievements
Rank 1
Haris asked on 04 Oct 2017, 07:10 AM

Hi,

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

 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Oct 2017, 09:45 AM
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.
Tags
Diagram, DiagramRibbonBar, DiagramToolBox
Asked by
Haris
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or