Text Selection in WPF Syntax Editor

7 May 20211 minute to read

The SyntaxEditor control supports the selection of content through mouse, keyboard, and touch interactions.

Selection using Mouse

User can select text using the mouse by clicking on a position and dragging the selection to the desired line position.

Selection using Keyboard with shortcuts

The following keyboard shortcuts are supported for content selection.

Selection Shortcut Keys

Description

Shift + Right arrow

Extends selection one position forward.

Shift + Left arrow

Extends selection one position backward.

Shift + Down arrow

Extends selection to the same position on the next line.

Shift + Up arrow

Extends selection to the same position on the previous line.

Shift + Home

Extends selection to the start of the current line.

Shift + End

Extends selection to the end of the current line.

Ctrl + Shift + Home

Extends selection to the document start position.

Ctrl + Shift + End

Extends selection to the document end position.

Ctrl + Shift + Right arrow

Extends selection to the current word end position.

Ctrl + Shift + Left arrow

Extends selection to the current word start position.

Ctrl + A

Selects the entire document.

Selection using Touch

Users can select text by double-tapping the desired word. Selection pointers will be displayed at the start and end positions of the selected content.

Selection using touch

Users can extend the selection by dragging the selection pointers. The following screenshot shows an extended selection of content.

Selection using touch

When a selection goes beyond the view port of the SyntaxEditor control, a scroll viewer will automatically bring new content into the view and the text selection will extend to that content.