Word-like Shift selection engine implementing Anchor–ActiveEnd model. Anchor stays fixed during session; ActiveEnd moves exactly one NavigationUnit per request;
Definition
Namespace:Telerik.Windows.Documents.Selection
Assembly:Telerik.Windows.Controls.RichTextBox.dll
Syntax:
public class KeyboardSelectionHandler
Inheritance: objectKeyboardSelectionHandler
Constructors
Initializes a new instance of the KeyboardSelectionHandler class.
public KeyboardSelectionHandler(RadDocument document)
The RadDocument to operate on.
Properties
Gets the underlying document associated with the current instance.
protected RadDocument Document { get; }
protected DocumentPosition LastCaretPosition { get; }
Methods
Begins a new selection session at the specified document position.
public void BeginSelection(DocumentPosition start)
The position to start the selection from.
Handles logic after the caret position in the document has changed. Updates selection and internal state based on the current context.
public void HandleDocumentCaretPositionChanged(bool isSelectionInProgress, bool shiftPressed, MoveCaretDirections direction = MoveCaretDirections.Unknown)
Indicates if a selection is currently in progress.
shiftPressedboolIndicates if the Shift key is pressed.
directionMoveCaretDirectionsThe direction in which the caret was moved.
Handles logic before the caret position in the document changes. Updates internal state and caret snapshot as needed.
public void HandleDocumentCaretPositionChanging()
Moves the active end of the selection by one navigation unit in the specified direction, updating the selection to reflect expansion or contraction. The caller must ensure the Shift key context.
public virtual void MoveActiveEnd(NavigationUnit unit, Direction direction)
The navigation unit to move by (character, cell, or paragraph).
directionDirectionThe direction to move the active end.