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

Assigning RadDiagramShape.Mouseclick eventhandler programmatically

2 Answers 115 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Aksel
Top achievements
Rank 1
Aksel asked on 29 Aug 2017, 01:20 PM

I'm trying to add clickable rectangles to a diagram, but the event handler doesn't execute. Why?

Thank you far any help!

private void button1_Click(object sender, EventArgs e)
       {
           var shape1 = new RadDiagramShape()
           {
               ElementShape = new RoundRectShape(0),
               Position = new Telerik.Windows.Diagrams.Core.Point(50, 50),
               Height = 100,
               Width = 100,
               BackColor = System.Drawing.Color.White,
               BorderBrush = new SolidBrush(System.Drawing.Color.Black),
               DrawBorder = true,
               ShouldHandleMouseInput = true,
               IsConnectorsManipulationEnabled = false,
               IsEditable = false,
               IsRotationEnabled = false,
               IsDraggingEnabled = false
           };
 
           shape1.MouseClick += shape_Click;
           radDiagram1.AddShape(shape1);
           radDiagram1.SelectionMode = Telerik.Windows.Diagrams.Core.SelectionMode.None;
       }
 
 
       private void shape_Click(object sender, EventArgs e)
       {
           ;
       }

2 Answers, 1 is accepted

Sort by
0
Aksel
Top achievements
Rank 1
answered on 29 Aug 2017, 01:38 PM
I'm sorry, never mind this post.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Aug 2017, 10:28 AM
Hello Aksel, 

Thank you for writing.  

In order to detect when a certain shape is clicked, it is necessary to handle the RadDiagram.ShapeClicked event.

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
Aksel
Top achievements
Rank 1
Answers by
Aksel
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or