Back to Devexpress

RichEditControl.Text Property

wpf-devexpress-dot-xpf-dot-richedit-dot-richeditcontrol-10181027.md

latest4.0 KB
Original Source

RichEditControl.Text Property

Gets or sets the plain text content of the control.

Namespace : DevExpress.Xpf.RichEdit

Assembly : DevExpress.Xpf.RichEdit.v25.2.dll

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
public string Text { get; set; }
vb
Public Property Text As String

Property Value

TypeDescription
String

A string, containing the document’s unformatted text.

|

Remarks

Use the SubDocument.Delete method with a SubDocument.Range as a parameter to clear the text of an existing document. This technique does not reset document properties. Use the RichEditControl.ClearUndo method to wipe off this operation’s trace so it cannot be undone, as follows:

csharp
richEdit.Document.Delete(richEdit.Document.Range);
richEdit.ClearUndo();
vb
richEdit.Document.Delete(richEdit.Document.Range)
richEdit.ClearUndo()

Assigning the Text property value results in a new loaded document that is imported from the plain text format. Check the Text property value when the RichEditControl.DocumentLoaded event handler, i.e. when the document is fully loaded.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Text 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.

syntax-highlighting-for-c-and-vb-code-using-devexpress-codeparser-and-syntax-highlight-tokens/CS/SyntaxHighlightSimple/MainWindow.xaml.cs#L116

csharp
{
    string newText = syntaxEditor.Text;
    // Determine language by file extension.

syntax-highlighting-for-c-and-vb-code-using-devexpress-codeparser-and-syntax-highlight-tokens/VB/SyntaxHighlightSimple/MainWindow.xaml.vb#L108

vb
Public Sub Execute() Implements ISyntaxHighlightService.Execute
    Dim newText As String = syntaxEditor.Text
    ' Determine language by file extension.

See Also

RtfText

HtmlText

MhtText

OdtBytes

DocxBytes

WordMLText

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace