New to Telerik UI for WPFStart a free 30-day trial

This class handles the mouse selection in RadRichTextBox.

Definition

Namespace:Telerik.Windows.Documents.Selection

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

C#
public class MouseSelectionHandler

Inheritance: objectMouseSelectionHandler

Constructors

C#
public MouseSelectionHandler(RadDocument document, IDocumentEditorPresenter presenter)
Parameters:documentRadDocumentpresenterIDocumentEditorPresenter

Fields

This maximum time between click that is considered double click.

C#
public static double DoubleClickTime

The number of pixels that is acceptable for the mouse to move when doble clicking.

C#
public static int MouseDoubleClickThreshold

The number of pixels that is considered a drag operation.

C#
public static int MouseDragThreshold

Properties

Gets the drop position for the mouse selection handler.

C#
public DocumentPosition DropPosition { get; }

Gets a value indicating whether the current mouse selection is a click selection.

C#
public bool IsClickSelecting { get; }

Gets a value indicating whether the mouse is currently dragging a selection.

C#
public bool IsDragging { get; }

Determines whether the selection is currently being dragged.

C#
public bool IsMoveSelectionDragging { get; }

Gets a value indicating whether the mouse selection handler is currently tracking mouse movements.

C#
public bool IsTracking { get; }

Methods

Cancels the current mouse selection, resetting any selected elements to their unselected state.

C#
public bool CancelSelection()
Returns:

bool

Returns a boolean indicating whether the selection was successfully canceled.

Handles changes to the document caret position in response to user interactions.

C#
public void HandleDocumentCaretPositionChanged(bool ctrlPressed, bool shiftPressed)
Parameters:ctrlPressedbool

Indicates whether the Control key is presses

shiftPressedbool

Indicates whether the Shift key is pressed

C#
protected virtual void OnSelectionDragged(SelectionDragEventArgs e)
Parameters:eSelectionDragEventArgs

Registers the mouse down event for a document, allowing for custom selection behavior.

C#
public virtual void RegisterDocumentMouseDown(bool ctrlPressed, bool shiftPressed, Point position, UIElement originalSource = null, SourceType source = SourceType.Mouse)
Parameters:ctrlPressedbool

Indicates if the Control key is pressed during the mouse down event.

shiftPressedbool

Indicates if the Shift key is pressed during the mouse down event.

positionPoint

The position of the mouse cursor when the mouse down event occurred.

originalSourceUIElement

The UI element that is the target of the mouse down event.

sourceSourceType

The source type of the selection event.

Registers a mouse move event for the document selection handler.

C#
public virtual void RegisterDocumentMouseMove(Point position, SourceType source = SourceType.Mouse)
Parameters:positionPoint

The point in the document where the mouse move event occurs.

sourceSourceType

The source type that indicates where the mouse move event originated from.

Registers the mouse right button down event for the specified UI element in the document selection.

C#
public virtual void RegisterDocumentMouseRightButtonDown(UIElement originalSource, SourceType source = SourceType.Mouse)
Parameters:originalSourceUIElement

The UI element to which the mouse right button down event is registered.

sourceSourceType

The source type indicating the origin of the selection action.

Registers a mouse up event handler for the document selection.

C#
public virtual void RegisterDocumentMouseUp(SourceType source = SourceType.Mouse, Point? position = null)
Parameters:sourceSourceType

The type of source that triggered the mouse up event.

positionPoint?

An optional point representing the location of the mouse up event.

C#
protected virtual void RegisterDocumentMultipleMouseDown(bool ctrlPressed, bool shiftPressed, Point position)
Parameters:ctrlPressedboolshiftPressedboolpositionPoint
C#
protected virtual void RegisterDocumentSingleMouseDown(bool ctrlPressed, bool shiftPressed, Point position, UIElement originalSource)
Parameters:ctrlPressedboolshiftPressedboolpositionPointoriginalSourceUIElement

Events

C#
public event EventHandler<SelectionDragEventArgs> SelectionDragged