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

Gestures in Diagram

1 Answer 97 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 13 Nov 2019, 08:51 PM

Hello,

I have a RadDiagram in a winform that displays an image (RadDiagramShape) with a box (RadDiagramShape) over it.  A third RadDiagramShape is used to display the region of the first image that the box is over.  Mouse events to control dragging and mouse scroll to make the box larger/smaller so that the user can move around the image and zoom in/out.  Similarly, the third shape has events for dragging and mouse scroll which controls the box as well.

I am trying to enable similar functionality with touch gestures, but am having some difficulties.  I can only seem to enable gestures for the diagram itself, but not for the RadDiagramShapes within it.  When I allow zoom gestures on the RadDiagram, it zooms the RadDiagram even though IsZoomEnabled = false.  This seems to prevent the zoom for the mouse controls, but not for the gestures.  It also moves the diagram around in some cases, although I can't seem to figure out what is moving as the position isn't changing.  Pan and Drag are not enabled.

I do not want to zoom into or move the RadDiagram.  I want to catch the gesture, and control the size of the box so that the user can zoom in/out as they do with the mouse controls.

In order to do this, I would have to cancel the event and manually process, but I can't seem to figure out a way to do this.

Any ideas?

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Nov 2019, 01:23 PM

Hello, Mike,

All gestures are defined at control level. Hence, if you need to customize the default logic somehow or just disable a certain gesture, you can create a derivative of RadDiagram and override its OnGesture method. Then, considering the GestureType, you can decide how to proceed further, either call the basic logic or skip it and perform your own: 
        public class CustomDiagram : Telerik.WinControls.UI.RadDiagram
        {
            protected override void OnGesture(GestureEventArgs args)
            {
                if (args.GestureType == GestureType.Zoom)
                {
                    return;
                }
                Console.WriteLine(args.GestureType);
                base.OnGesture(args);
            }
        }

Additional information about the touch support is available in the following help article: https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/touch-support  

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
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.
Tags
Diagram, DiagramRibbonBar, DiagramToolBox
Asked by
Mike
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or