ClassKeyboardSelectionHandler
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
KeyboardSelectionHandler(RadDocument)
Initializes a new instance of the KeyboardSelectionHandler class.
Declaration
public KeyboardSelectionHandler(RadDocument document)
Parameters
document
The RadDocument to operate on.
Properties
Document
Gets the underlying document associated with the current instance.
LastCaretPosition
Declaration
protected DocumentPosition LastCaretPosition { get; }
Property Value
Methods
BeginSelection(DocumentPosition)
Begins a new selection session at the specified document position.
Declaration
public void BeginSelection(DocumentPosition start)
Parameters
start
The position to start the selection from.
HandleDocumentCaretPositionChanged(bool, bool, MoveCaretDirections)
Handles logic after the caret position in the document has changed. Updates selection and internal state based on the current context.
Declaration
public void HandleDocumentCaretPositionChanged(bool isSelectionInProgress, bool shiftPressed, MoveCaretDirections direction = MoveCaretDirections.Unknown)
Parameters
isSelectionInProgress
Indicates if a selection is currently in progress.
shiftPressed
Indicates if the Shift key is pressed.
direction
The direction in which the caret was moved.
HandleDocumentCaretPositionChanging()
Handles logic before the caret position in the document changes. Updates internal state and caret snapshot as needed.
Declaration
public void HandleDocumentCaretPositionChanging()
MoveActiveEnd(NavigationUnit, Direction)
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.
Declaration
public virtual void MoveActiveEnd(NavigationUnit unit, Direction direction)
Parameters
unit
The navigation unit to move by (character, cell, or paragraph).
direction
The direction to move the active end.