Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Document.CaretPosition Property

Gets or sets the position of the caret within the document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v19.1.Core.dll

Declaration

DocumentPosition CaretPosition { get; set; }

Property Value

Type Description
DocumentPosition

A DocumentPosition object, representing the current caret position.

Remarks

Use this property to insert text at the current cursor position or to access the paragraph where the cursor is located (the ReadOnlyParagraphCollection.Get method).

Note

When working with headers/footers, use the DocumentPosition.BeginUpdateDocument - DocumentPosition.EndUpdateDocument pair to get the correct position. Otherwise an InvalidOperationException is thrown.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CaretPosition property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also