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

Represents a text document.

Definition

Namespace:Telerik.Windows.SyntaxEditor.Core.Text

Assembly:Telerik.Windows.SyntaxEditor.Core.dll

Syntax:

C#
public class TextDocument

Inheritance: objectTextDocument

Constructors

Initializes a new instance of the TextDocument class.

C#
public TextDocument()

Initializes a new instance of the TextDocument class.

C#
public TextDocument(string text)
Parameters:textstring

Initializes a new instance of the TextDocument class.

C#
public TextDocument(TextDocument document)
Parameters:documentTextDocument

Initializes a new instance of the TextDocument class.

C#
public TextDocument(TextReader textReader)
Parameters:textReaderTextReader

Properties

Gets the current snapshot.

C#
public TextSnapshot CurrentSnapshot { get; }

Gets the document history.

C#
public TextDocumentHistory History { get; }

Methods

Deletes the given span.

C#
public bool Delete(Span spanToDelete)
Parameters:spanToDeleteSpanReturns:

bool

Looks up for a span containing the search text or matching a regex pattern.

C#
public Span? Find(string searchText, int startIndex, bool matchCase, bool useRegularExpression, bool matchWord)
Parameters:searchTextstringstartIndexintmatchCasebooluseRegularExpressionboolmatchWordboolReturns:

Span?

Looks up for a span containing the search text or matching a regex pattern.

C#
public Span? Find(string searchText, int startIndex, bool matchCase, bool useRegularExpression)
Parameters:searchTextstringstartIndexintmatchCasebooluseRegularExpressionboolReturns:

Span?

Looks up for a span containing the search text.

C#
public Span? Find(string searchText, int startIndex, bool useRegularExpression)
Parameters:searchTextstringstartIndexintuseRegularExpressionboolReturns:

Span?

Looks up for a span containing the search text.

C#
public Span? Find(string searchText, int startIndex)
Parameters:searchTextstringstartIndexintReturns:

Span?

Looks up for a all spans containing the search text or matching a regex pattern.

C#
public IEnumerable<Span> FindAll(string searchText, bool matchCase, bool useRegularExpression, bool matchWord = false)
Parameters:searchTextstringmatchCasebooluseRegularExpressionboolmatchWordboolReturns:

IEnumerable<Span>

Looks up for a all spans containing the search text or matching a regex pattern.

C#
public IEnumerable<Span> FindAll(string searchText, bool useRegularExpression)
Parameters:searchTextstringuseRegularExpressionboolReturns:

IEnumerable<Span>

Looks up for a all spans containing the search text.

C#
public IEnumerable<Span> FindAll(string searchText)
Parameters:searchTextstringReturns:

IEnumerable<Span>

Looks up for a previous span containing the search text or matching a regex pattern.

C#
public Span? FindPrevious(string searchText, int startIndex, bool matchCase, bool useRegularExpression, bool matchWord)
Parameters:searchTextstringstartIndexintmatchCasebooluseRegularExpressionboolmatchWordboolReturns:

Span?

Looks up for a previous span containing the search text or matching a regex pattern.

C#
public Span? FindPrevious(string searchText, int startIndex, bool matchCase)
Parameters:searchTextstringstartIndexintmatchCaseboolReturns:

Span?

Inserts text at the given position.

C#
public bool Insert(int position, string text)
Parameters:positioninttextstringReturns:

bool

Raises the PreviewTextContentChanged event.

C#
protected virtual void OnPreviewTextContentChanged(TextContentChangedEventArgs args)
Parameters:argsTextContentChangedEventArgs

Raises the PreviewTextContentChanging event.

C#
protected virtual void OnPreviewTextContentChanging(TextContentChangingEventArgs args)
Parameters:argsTextContentChangingEventArgs

Raises the TextContentChanged event.

C#
protected virtual void OnTextContentChanged(TextContentChangedEventArgs args)
Parameters:argsTextContentChangedEventArgs

Raises the TextContentChanging event.

C#
protected virtual void OnTextContentChanging(TextContentChangingEventArgs args)
Parameters:argsTextContentChangingEventArgs

Replaces the given span with the given replace text.

C#
public bool Replace(Span spanToReplace, string replaceText)
Parameters:spanToReplaceSpanreplaceTextstringReturns:

bool

Replaces all matched strings of the given search text with the provided replace text.

C#
public int ReplaceAllMatches(string searchText, string replaceText, bool matchCase, bool useRegularExpression, bool matchWord = false)
Parameters:searchTextstringreplaceTextstringmatchCasebooluseRegularExpressionboolmatchWordboolReturns:

int

Replaces the next matched strings of the given search text with the provided replace text.

C#
public bool ReplaceNextMatch(string searchText, int startIndex, string replaceText, bool matchCase, bool useRegularExpression)
Parameters:searchTextstringstartIndexintreplaceTextstringmatchCasebooluseRegularExpressionboolReturns:

bool

Events

Occurs when text is about to be changed.

C#
public event EventHandler<TextContentChangedEventArgs> PreviewTextContentChanged

Occurs when text is about to be changing.

C#
public event EventHandler<TextContentChangingEventArgs> PreviewTextContentChanging

Occurs when text is changed.

C#
public event EventHandler<TextContentChangedEventArgs> TextContentChanged

Occurs when text is changing.

C#
public event EventHandler<TextContentChangingEventArgs> TextContentChanging