The RadSyntaxEditor comes with out-of-the-box support for touch gestures.
When using touch, touch selector markers appear when the user taps on the editor. Swiping 30 pixels around them moves the selection's start/end. Switching to a mouse device hides the markers. The markers are also hidden during a swipe or pinch. Swiping over the line numbers selects each of the lines the swipe passes over.
|Moves the caret under the finger
|Selects the word under the finger
|Scales the document (the ScaleFactor changes)
|Scrolls the document
|Scrolls the document continuously with increased speed
If you wish to implement your own touch logic, you can override the InitializeTouch method of the RadSyntaxEditor.
Example 1: Default InitializeTouch method
protected override void InitializeTouch(SyntaxEditorPresenter presenter)
TouchManager.AddSwipeEventHandler(presenter, new SwipeEventHandler(OnSwipe));
private void OnSwipe(object sender, SwipeEventArgs args)
// your custom logic for swiping
args.Handled = true; // you can omit this if your custom logic does not contradict with the default logic
You can read the following article article, which describes all of the events exposed by the TouchManager.
By default, dragging the markers is possible if the swipe occurs up to 30 pixels from their center. This area can be controlled via the TouchMarkerDragDistance property of the RadSyntaxEditor control.
Example 2: Increase markers drag area
this.syntaxEditor.TouchMarkerDragDistance = 40;