Assigning RadDiagramShape.Mouseclick eventhandler programmatically

3 posts, 0 answers
  1. Aksel
    Aksel avatar
    2 posts
    Member since:
    Aug 2017

    Posted 29 Aug 2017 Link to this post

    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. Aksel
    Aksel avatar
    2 posts
    Member since:
    Aug 2017

    Posted 29 Aug 2017 Link to this post

    I'm sorry, never mind this post.
  3. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3835 posts

    Posted 30 Aug 2017 Link to this post

    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.
Back to Top