| C# | Visual Basic | Visual C++ |
public sealed class TextDocument : IDocument, ITextSource, IServiceProvider, INotifyPropertyChanged
Public NotInheritable Class TextDocument _ Implements IDocument, ITextSource, IServiceProvider, INotifyPropertyChanged
public ref class TextDocument sealed : IDocument, ITextSource, IServiceProvider, INotifyPropertyChanged
| All Members | Constructors | Methods | Properties | Events | |
| Icon | Member | Description |
|---|---|---|
| TextDocument()()()() |
Create an empty text document.
| |
| TextDocument(IEnumerable<(Of <<'(Char>)>>)) |
Create a new text document with the specified initial text.
| |
| TextDocument(ITextSource) |
Create a new text document with the specified initial text.
| |
| BeginUpdate()()()() | Begins a group of document changes. Some events are suspended until EndUpdate is called, and the UndoStack will group all changes into a single action. Calling BeginUpdate several times increments a counter, only after the appropriate number of EndUpdate calls the events resume their work. | |
| Changed |
Is raised after the document has changed.
| |
| Changing |
Is raised before the document changes.
| |
| CreateAnchor(Int32) |
Creates a new TextAnchor at the specified offset.
| |
| CreateReader()()()() |
Creates a new TextReader to read from this text source.
| |
| CreateReader(Int32, Int32) |
Creates a new TextReader to read from this text source.
| |
| CreateSnapshot()()()() |
Creates a snapshot of the current text.
| |
| CreateSnapshot(Int32, Int32) |
Creates a snapshot of a part of the current text.
| |
| EndUpdate()()()() |
Ends a group of document changes.
| |
| Equals(Object) | (Inherited from Object.) | |
| FileName |
Gets the name of the file the document is stored in.
Could also be a non-existent dummy file name or null if no name has been set.
| |
| FileNameChanged |
Fired when the file name of the document changes.
| |
| GetCharAt(Int32) |
Gets a character at the specified position in the document.
| |
| GetHashCode()()()() | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetLineByNumber(Int32) |
Gets a line by the line number: O(log n)
| |
| GetLineByOffset(Int32) |
Gets a document lines by offset.
Runtime: O(log n)
| |
| GetLocation(Int32) |
Gets the location from an offset.
| |
| GetOffset(TextLocation) |
Gets the offset from a text location.
| |
| GetOffset(Int32, Int32) |
Gets the offset from a text location.
| |
| GetText(Int32, Int32) |
Retrieves the text for a portion of the document.
| |
| GetText(ISegment) |
Retrieves the text for a portion of the document.
| |
| GetType()()()() | Gets the Type of the current instance. (Inherited from Object.) | |
| IndexOf(Char, Int32, Int32) |
Gets the index of the first occurrence of the character in the specified array.
| |
| IndexOf(String, Int32, Int32, StringComparison) |
Gets the index of the first occurrence of the specified search text in this text source.
| |
| IndexOfAny(array<Char>[]()[][], Int32, Int32) |
Gets the index of the first occurrence of any character in the specified array.
| |
| Insert(Int32, String) |
Inserts text.
| |
| Insert(Int32, ITextSource) |
Inserts text.
| |
| Insert(Int32, String, AnchorMovementType) |
Inserts text.
| |
| Insert(Int32, ITextSource, AnchorMovementType) |
Inserts text.
| |
| IsInUpdate |
Gets if an update is running.
| |
| LastIndexOf(Char, Int32, Int32) |
Gets the index of the last occurrence of the specified character in this text source.
| |
| LastIndexOf(String, Int32, Int32, StringComparison) |
Gets the index of the last occurrence of the specified search text in this text source.
| |
| LineCount |
Gets the total number of lines in the document.
Runtime: O(1).
| |
| LineCountChanged | Obsolete.
Is raised when the LineCount property changes.
| |
| Lines |
Gets a read-only list of lines.
| |
| LineTrackers |
Gets the list of ILineTrackers attached to this document.
You can add custom line trackers to this list.
| |
| PropertyChanged | ||
| Remove(ISegment) |
Removes text.
| |
| Remove(Int32, Int32) |
Removes text.
| |
| Replace(ISegment, String) |
Replaces text.
| |
| Replace(ISegment, ITextSource) |
Replaces text.
| |
| Replace(Int32, Int32, String) |
Replaces text.
| |
| Replace(Int32, Int32, ITextSource) |
Replaces text.
| |
| Replace(Int32, Int32, String, OffsetChangeMappingType) |
Replaces text.
| |
| Replace(Int32, Int32, ITextSource, OffsetChangeMappingType) |
Replaces text.
| |
| Replace(Int32, Int32, String, OffsetChangeMap) |
Replaces text.
| |
| Replace(Int32, Int32, ITextSource, OffsetChangeMap) |
Replaces text.
| |
| RunUpdate()()()() |
Immediately calls BeginUpdate()()()(),
and returns an IDisposable that calls EndUpdate()()()().
| |
| ServiceProvider |
Gets/Sets the service provider associated with this document.
By default, every TextDocument has its own ServiceContainer; and has the document itself
registered as IDocument and TextDocument.
| |
| SetOwnerThread(Thread) |
Transfers ownership of the document to another thread. This method can be used to load
a file into a TextDocument on a background thread and then transfer ownership to the UI thread
for displaying the document.
| |
| Text |
Gets/Sets the text of the whole document.
| |
| TextChanged | ||
| TextLength |
Gets the total text length.
| |
| TextLengthChanged | Obsolete.
Is raised when the TextLength property changes.
| |
| ToString()()()() | (Inherited from Object.) | |
| UndoStack |
Gets the UndoStack of the document.
| |
| UpdateFinished |
Occurs when a document change is finished.
| |
| UpdateStarted |
Occurs when a document change starts.
| |
| VerifyAccess()()()() |
Verifies that the current thread is the documents owner thread.
Throws an InvalidOperationException if the wrong thread accesses the TextDocument.
| |
| Version |
Gets a version identifier for this text source.
Returns null for unversioned text sources.
| |
| WriteTextTo(TextWriter) |
Writes the text from this document into the TextWriter.
| |
| WriteTextTo(TextWriter, Int32, Int32) |
Writes the text from this document into the TextWriter.
|
The TextDocument class is not thread-safe. A document instance expects to have a single owner thread and will throw an InvalidOperationException when accessed from another thread. It is possible to change the owner thread using the SetOwnerThread(Thread) method.
However, there is a single method that is thread-safe: CreateSnapshot()()()() (and its overloads).
| Object | |
| TextDocument | |
Assembly: ICSharpCode.AvalonEdit (Module: ICSharpCode.AvalonEdit.dll) Version: 5.0.0.4238