EditorView Class
Represents a text view that supports editing within a SyntaxEditor control.
public class EditorView : TextView, IEditorView, ITextView, ITextViewTaggerProvider, IEditorViewIntelliPrompt, IEditorViewSearcher, IEditorViewTextChangeActions, ITextPositionFinder
- Inheritance:
- object Visual UIElement FrameworkElement Control ContentControl TextView object
- Implements:
- IEditorView ITextView ITextViewTaggerProvider IEditorViewIntelliPrompt IEditorViewSearcher IEditorViewTextChangeActions ITextPositionFinder
Properties
CanSplitHorizontally
Gets whether the view can be split horizontally via a splitter.
public bool CanSplitHorizontally { get; }
Property Value
- bool:
true
if the view can be split horizontally via a splitter; otherwise,false
.
ClassificationTagAggregator
Gets the IClassificationTag aggregator for the view.
protected override ITagAggregator<IClassificationTag> ClassificationTagAggregator { get; }
Property Value
- ITagAggregator<IClassificationTag>:
The IClassificationTag aggregator for the view.
CollapsedRegionManager
Gets an ICollapsedRegionManager that provides information about collapsed regions in the view.
public override ICollapsedRegionManager CollapsedRegionManager { get; }
Property Value
- ICollapsedRegionManager:
An ICollapsedRegionManager that provides information about collapsed regions in the view.
ContainsFocus
Gets whether the view currently has or contains keyboard focus.
public bool ContainsFocus { get; }
Property Value
- bool:
true
if the view currently has or contains keyboard focus; otherwise,false
.
Remarks
A view can contain focus if a nested control such as an adornment or search overlay pane has focus.
CurrentSnapshotLine
Gets the current ITextSnapshotLine that the primary caret appears on within the view.
public ITextSnapshotLine CurrentSnapshotLine { get; }
Property Value
- ITextSnapshotLine:
The current ITextSnapshotLine that the primary caret appears on within the view.
CurrentViewLine
Gets the current ITextViewLine that the primary caret appears on within the view.
public ITextViewLine CurrentViewLine { get; }
Property Value
- ITextViewLine:
The current ITextViewLine that the primary caret appears on within the view.
HasFocus
Gets whether the view currently has keyboard focus.
public bool HasFocus { get; }
Property Value
- bool:
true
if the view currently has keyboard focus; otherwise,false
.
HighlightedResultSearchOptions
Gets or sets the ISearchOptions to use for searching when highlighting search results.
public ISearchOptions HighlightedResultSearchOptions { get; set; }
Property Value
- ISearchOptions:
The ISearchOptions to use for searching when highlighting search results.
Remarks
Highlighted results are displayed when using incremental search and the IsSearchResultHighlightingEnabled property is set to true
.
This property can also be manually set when using a search pane as the user types, so that results will be immediately displayed.
Set the property to null
to stop highlighting.
HighlightingStyleRegistry
Gets the IHighlightingStyleRegistry used by this view.
public override IHighlightingStyleRegistry HighlightingStyleRegistry { get; }
Property Value
- IHighlightingStyleRegistry:
The IHighlightingStyleRegistry used by this view.
IntelliPrompt
Gets the IEditorViewIntelliPrompt to use for requesting IntelliPrompt within the view.
public IEditorViewIntelliPrompt IntelliPrompt { get; }
Property Value
- IEditorViewIntelliPrompt:
The IEditorViewIntelliPrompt to use for requesting IntelliPrompt within the view.
IntraLineSpacerTagAggregator
Gets the IIntraLineSpacerTag aggregator for the view.
protected override ITagAggregator<IIntraLineSpacerTag> IntraLineSpacerTagAggregator { get; }
Property Value
- ITagAggregator<IIntraLineSpacerTag>:
The IIntraLineSpacerTag aggregator for the view.
IntraTextSpacerTagAggregator
Gets the IIntraTextSpacerTag aggregator for the view.
protected override ITagAggregator<IIntraTextSpacerTag> IntraTextSpacerTagAggregator { get; }
Property Value
- ITagAggregator<IIntraTextSpacerTag>:
The IIntraTextSpacerTag aggregator for the view.
IsActive
Gets whether the view is the currently-active view in the editor.
public bool IsActive { get; }
Property Value
- bool:
true
if the view is the currently-active view in the editor; otherwise,false
.
Remarks
The currently-active view in the editor is the view that contains focus when focus is moved within the editor. There is always a single view in an editor marked as active.
IsIncrementalSearchActive
Gets or sets whether incremental searching is active.
public bool IsIncrementalSearchActive { get; set; }
Property Value
- bool:
true
if incremental searching is active; otherwise,false
.
IsWhitespaceVisible
Gets whether whitespace (spaces and tabs) is visible.
public override bool IsWhitespaceVisible { get; }
Property Value
- bool:
true
if whitespace (spaces and tabs) is visible; otherwise,false
.
Margins
Gets the collection of margins that are currently in the view.
public IEditorViewMarginCollection Margins { get; }
Property Value
- IEditorViewMarginCollection:
The collection of margins that are currently in the view.
OverlayPanes
Gets the collection of IOverlayPane instances that are open in the view.
public IEditorViewOverlayPaneCollection OverlayPanes { get; }
Property Value
- IEditorViewOverlayPaneCollection:
The collection of IOverlayPane instances that are open in the view.
Placement
Gets a EditorViewPlacement indicating the location of the view.
public EditorViewPlacement Placement { get; }
Property Value
- EditorViewPlacement:
A EditorViewPlacement indicating the location of the view.
PositionFinder
Gets the ITextPositionFinder that can be used to find TextPosition objects relative to another specified TextPosition.
public ITextPositionFinder PositionFinder { get; }
Property Value
- ITextPositionFinder:
The ITextPositionFinder instance.
ScrollableContentHostBounds
Gets a System.Windows.Rect indicating the bounds of scrollable content host, relative to view coordinates.
protected override Rect ScrollableContentHostBounds { get; }
Property Value
- Rect:
A System.Windows.Rect indicating the bounds of scrollable content host, relative to view coordinates.
Searcher
Gets the IEditorViewSearcher that is used to perform find/replace and other search-related operations on the view.
public IEditorViewSearcher Searcher { get; }
Property Value
- IEditorViewSearcher:
The IEditorViewSearcher that is used to perform find/replace and other search-related operations on the view.
SelectedText
Gets or sets the text of the current primary selection range in the view.
public string SelectedText { get; set; }
Property Value
- string:
The text of the current primary selection range in the view.
Selection
Gets an IEditorViewSelection that manages the selection within the view.
public IEditorViewSelection Selection { get; }
Property Value
- IEditorViewSelection:
An IEditorViewSelection that manages the selection within the view.
SelectionScopeSnapshotRange
Gets the TextSnapshotRange in which to search for selection-based scopes.
public TextSnapshotRange SelectionScopeSnapshotRange { get; }
Property Value
- TextSnapshotRange:
The TextSnapshotRange in which to search for selection-based scopes.
SquiggleTagAggregator
Gets the ISquiggleTag aggregator for the view.
protected override ITagAggregator<ISquiggleTag> SquiggleTagAggregator { get; }
Property Value
- ITagAggregator<ISquiggleTag>:
The ISquiggleTag aggregator for the view.
TagTypes
Gets the ITagType
objects that are supported by the ITagger<T> objects created by this provider.
public IEnumerable<Type> TagTypes { get; }
Property Value
- IEnumerable<Type>:
The ITag
Type
objects that are supported by the ITagger<T> objects created by this provider.
TextAreaPadding
Gets the padding thickness around the text area content.
public override Thickness TextAreaPadding { get; }
Property Value
- Thickness:
The padding thickness around the text area content.
TextAreaSize
Gets the size of the text area in text area coordinates.
public override Size TextAreaSize { get; }
Property Value
- Size:
The size of the text area in text area coordinates.
TextAreaViewportBounds
Gets a System.Windows.Rect indicating the bounds of the visible portion of the text area, relative to view coordinates.
public override Rect TextAreaViewportBounds { get; }
Property Value
- Rect:
A System.Windows.Rect indicating the bounds of the visible portion of the text area, relative to view coordinates.
TextChangeActions
Gets the IEditorViewTextChangeActions that is used to perform text change actions in the view.
public IEditorViewTextChangeActions TextChangeActions { get; }
Property Value
- IEditorViewTextChangeActions:
The IEditorViewTextChangeActions that is used to perform text change actions in the view.
UnusedRegionTagAggregator
Gets the IUnusedRegionTag aggregator for the view.
protected override ITagAggregator<IUnusedRegionTag> UnusedRegionTagAggregator { get; }
Property Value
- ITagAggregator<IUnusedRegionTag>:
The IUnusedRegionTag aggregator for the view.
UseSyntaxEditorDisplayItemProperties
Gets whether to use SyntaxEditor display item properties.
protected override bool UseSyntaxEditorDisplayItemProperties { get; }
Property Value
- bool:
true
if SyntaxEditor display item properties should be used; otherwise,false
.
WordWrapMode
Gets a WordWrapMode value indicating the type of word wrapping that is performed.
protected override WordWrapMode WordWrapMode { get; }
Property Value
- WordWrapMode:
A WordWrapMode value indicating the type of word wrapping that is performed.
Methods
Activate()
Activates this view.
public void Activate()
Remarks
The currently-active view in the editor is the view that contains focus when focus is moved within the editor. There is always a single view in an editor marked as active.
Backspace()
Deletes the currently selected text if text is selected; otherwise, deletes the previous character.
public void Backspace()
BackspaceToPreviousWord()
Backspaces and deletes text to the beginning of the previous word.
public void BackspaceToPreviousWord()
ChangeCharacterCasing(CharacterCasing)
Changes the character casing of the selected text in the view.
public void ChangeCharacterCasing(CharacterCasing casing)
Parameter | Type | Description |
---|---|---|
casing | CharacterCasing | A CharacterCasing indicating the character case to change to. |
Remarks
If no text is currently selected in the view, only the character after the caret is changed.
A casing
value of CharacterCasing.Normal
will capitalize the first letter of each word.
Close()
Closes the view.
protected override void Close()
CommentLines()
Comments the currently selected lines, using the ILineCommenter specified by the current ISyntaxLanguage.
public void CommentLines()
ConvertSpacesToTabs()
Converts all spaces in the selection to an equivalent number of tabs.
public void ConvertSpacesToTabs()
ConvertTabsToSpaces()
Converts all tabs in the selection to an equivalent number of spaces.
public void ConvertTabsToSpaces()
CopyAndAppendToClipboard()
Copies the currently selected text and appends it to the existing text on the clipboard.
public void CopyAndAppendToClipboard()
CopyToClipboard()
Copies the currently selected text to the clipboard.
public void CopyToClipboard()
CreateTagAggregator<T>()
Creates a new ITagAggregator<T> that collects the tag results from all ITagger<T> instances associated with this view.
public override ITagAggregator<T> CreateTagAggregator<T>() where T : ITag
- Type Parameters:
-
T
-The type of ITag associated with this aggregator.
Returns
- ITagAggregator<T>:
The ITagAggregator<T> that was created.
CutAndAppendToClipboard()
Cuts the currently selected text and appends it to the existing text on the clipboard.
public void CutAndAppendToClipboard()
CutLineToClipboard()
Cuts the currently active view line to the clipboard.
public void CutLineToClipboard()
CutToClipboard()
Cuts the currently selected text to the clipboard.
public void CutToClipboard()
Delete()
Deletes the currently selected text if text is selected; otherwise, deletes the next character.
public void Delete()
DeleteBlankLines()
Deletes the blank lines in the selected text, or the current view line if no text is selected and it is blank.
public void DeleteBlankLines()
Remarks
If there is no selection and the current line is not blank, any blank view lines immediately before the current view line will be deleted.
DeleteHorizontalWhitespace()
Deletes the horizontal whitespace within the current selection.
public void DeleteHorizontalWhitespace()
DeleteLine()
Deletes the currently active view line.
public void DeleteLine()
DeleteSelectedText(ITextChangeType)
Performs a delete text change by deleting the view's selected text ranges.
public bool DeleteSelectedText(ITextChangeType type)
Parameter | Type | Description |
---|---|---|
type | ITextChangeType | An ITextChangeType specifying the type of change. |
Returns
- bool:
true
if a text change was allowed to occur; otherwise,false
.
DeleteSelectedText(ITextChangeType, IEditorViewTextChangeOptions)
Performs a delete text change by deleting the view's selected text ranges.
public bool DeleteSelectedText(ITextChangeType type, IEditorViewTextChangeOptions options)
Parameter | Type | Description |
---|---|---|
type | ITextChangeType | An ITextChangeType specifying the type of change. |
options | IEditorViewTextChangeOptions | The IEditorViewTextChangeOptions for the change. |
Returns
- bool:
true
if a text change was allowed to occur; otherwise,false
.
DeleteToLineEnd()
Deletes the currently selected text through to the end of the current view line.
public void DeleteToLineEnd()
DeleteToLineStart()
Deletes the currently selected text through to the start of the current view line.
public void DeleteToLineStart()
DeleteToNextWord()
Deletes text to the beginning of the next word.
public void DeleteToNextWord()
Duplicate()
Duplicates the current document line if there is no selection, or the selected text if there is a selection.
public void Duplicate()
ExecuteEditAction(IEditAction)
Executes the specified IEditAction within the view and records the action within a macro when appropriate.
public bool ExecuteEditAction(IEditAction action)
Parameter | Type | Description |
---|---|---|
action | IEditAction | The IEditAction to execute. |
Returns
- bool:
true
if the action was able to execute; otherwise,false
.
ExportSelectedText(ITextExporter)
Exports the selected text to another text format, such as HTML
or RTF
.
public string ExportSelectedText(ITextExporter exporter)
Parameter | Type | Description |
---|---|---|
exporter | ITextExporter | The ITextExporter to use for the export operation. |
Returns
- string:
The exported text.
FindAll(IEditorSearchOptions)
Performs a find all operation.
public ISearchResultSet FindAll(IEditorSearchOptions options)
Parameter | Type | Description |
---|---|---|
options | IEditorSearchOptions | The IEditorSearchOptions to use. |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
FindCurrentOrNext(IEditorSearchOptions)
Performs a find next operation that can possibly match at the current caret offset.
public ISearchResultSet FindCurrentOrNext(IEditorSearchOptions options)
Parameter | Type | Description |
---|---|---|
options | IEditorSearchOptions | The IEditorSearchOptions to use. |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
FindCurrentWordEnd()
Returns the document offset of the word end character that occurs at or after the primary caret.
public int FindCurrentWordEnd()
Returns
- int:
The document offset of the word end character that occurs at or after the primary caret.
FindCurrentWordStart()
Returns the document offset of the word start character that occurs at or before the primary caret.
public int FindCurrentWordStart()
Returns
- int:
The document offset of the word start character that occurs at or before the primary caret.
FindNext(IEditorSearchOptions)
Performs a find next operation.
public ISearchResultSet FindNext(IEditorSearchOptions options)
Parameter | Type | Description |
---|---|---|
options | IEditorSearchOptions | The IEditorSearchOptions to use. |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
FindNextIncremental(bool)
Performs an incremental search find next operation.
public ISearchResultSet FindNextIncremental(bool searchUp)
Parameter | Type | Description |
---|---|---|
searchUp | bool | Whether to search upwards. |
Returns
- ISearchResultSet:
A ISearchResultSet that specifies the result of the operation.
FindNextWordStart()
Returns the document offset of the word start character that occurs after the primary caret.
public int FindNextWordStart()
Returns
- int:
The document offset of the word start character that occurs after the primary caret.
FindPreviousWordStart()
Returns the document offset of the word start character that occurs before the primary caret.
public int FindPreviousWordStart()
Returns
- int:
The document offset of the word start character that occurs before the primary caret.
Focus(FocusState)
Ensures the view has focus.
public bool Focus(FocusState state)
Parameter | Type | Description |
---|---|---|
state | FocusState | A FocusState specifying the reason for focus to be set. |
Returns
- bool:
true
if focus was successfully set or was already set; otherwise,false
.
FormatDocument()
Formats the entire document, using the ILineCommenter specified by the current ISyntaxLanguage..
public void FormatDocument()
FormatSelection()
Formats the currently selected lines, using the ITextFormatter specified by the current ISyntaxLanguage..
public void FormatSelection()
GetAdornmentLayer(AdornmentLayerDefinition)
Returns an IAdornmentLayer for the view with the specified definition.
public override IAdornmentLayer GetAdornmentLayer(AdornmentLayerDefinition layerDefinition)
Parameter | Type | Description |
---|---|---|
layerDefinition | AdornmentLayerDefinition | The layer definition. |
Returns
- IAdornmentLayer:
An IAdornmentLayer for the view with the specified string-based key.
Remarks
If no IAdornmentLayer already exists with the specified name, one is created.
GetCharacterBounds(TextPosition)
Returns the TextBounds for the specified TextPosition, relative to the text area's coordinates.
public TextBounds GetCharacterBounds(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition whose bounds need to be retrieved. |
Returns
- TextBounds:
A TextBounds containing the visible character bounds for the specified TextPosition.
GetCharacterBounds(int)
Returns the TextBounds for the specified offset, relative to the text area's coordinates.
public TextBounds GetCharacterBounds(int offset)
Parameter | Type | Description |
---|---|---|
offset | int | The offset whose bounds need to be retrieved. |
Returns
- TextBounds:
A TextBounds containing the visible character bounds for the specified offset.
GetCharacterBounds(int, bool)
Returns the TextBounds for the specified offset, relative to the text area's coordinates.
public TextBounds GetCharacterBounds(int offset, bool hasFarAffinity)
Parameter | Type | Description |
---|---|---|
offset | int | The offset whose bounds need to be retrieved. |
hasFarAffinity | bool | Whether the offset has affinity for the far side, which is used when the offset is where a view line is wrapped to a second view line. |
Returns
- TextBounds:
A TextBounds containing the visible character bounds for the specified offset.
GetCharacterColumn(TextPosition)
Returns the column index within the view for the specified TextPosition.
public int GetCharacterColumn(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition whose column index is being requested. |
Returns
- int:
The column index within the view for the specified TextPosition.
GetCharacterColumn(int)
Returns the column index within the view for the specified offset.
public int GetCharacterColumn(int offset)
Parameter | Type | Description |
---|---|---|
offset | int | The offset whose column index is being requested. |
Returns
- int:
The column index within the view for the specified offset.
GetCharacterColumn(int, bool)
Returns the column index within the view for the specified offset.
public int GetCharacterColumn(int offset, bool hasFarAffinity)
Parameter | Type | Description |
---|---|---|
offset | int | The offset whose column index is being requested. |
hasFarAffinity | bool | Whether the offset has affinity for the far side, which is used when the offset is where a view line is wrapped to a second view line. |
Returns
- int:
The column index within the view for the specified offset.
GetCharacterIndexRanges(TextPositionRange)
Returns the collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.
public IList<Range> GetCharacterIndexRanges(TextPositionRange positionRange)
Parameter | Type | Description |
---|---|---|
positionRange | TextPositionRange | The TextPositionRange to examine. |
Returns
- IList<Range>:
The collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.
GetCharacterIndexRanges(TextPositionRange, int)
Returns the collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.
public IList<Range> GetCharacterIndexRanges(TextPositionRange positionRange, int minimumLines)
Parameter | Type | Description |
---|---|---|
positionRange | TextPositionRange | The TextPositionRange to examine. |
minimumLines | int | The minimum number of lines to return, used for block selections. |
Returns
- IList<Range>:
The collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.
GetCurrentWordText()
Gets the text of the current word.
GetCurrentWordTextRange()
Gets the TextRange for the current word.
public TextRange GetCurrentWordTextRange()
Returns
GetPositionForCharacterDelta(TextPosition, int, bool, bool)
Returns the TextPosition that is relative to the specified TextPosition by a number of visible characters.
public TextPosition GetPositionForCharacterDelta(TextPosition position, int characterDelta, bool wrapAtLineTerminators, bool forceVirtualSpace)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The start TextPosition from which to search. |
characterDelta | int | The number of visible characters (can be negative) relative to the start TextPosition that should be traversed to find the result. |
wrapAtLineTerminators | bool | Whether to wrap to the next/previous view line when a line terminator is encountered. |
forceVirtualSpace | bool | Whether to force virtual space to be used (for block selections). |
Returns
- TextPosition:
The TextPosition that would found based on the criteria.
GetPositionForLineDelta(TextPosition, int, double?, bool)
Returns the TextPosition that is relative to the specified TextPosition by a number of visible view lines.
public TextPosition GetPositionForLineDelta(TextPosition position, int lineDelta, double? preferredHorizontalLocation, bool forceVirtualSpace)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The start TextPosition from which to search. |
lineDelta | int | The number of visible view lines (can be negative) relative to the start TextPosition that should be traversed to find the result. |
preferredHorizontalLocation | double? | The preferred horizontal location, if known. |
forceVirtualSpace | bool | Whether to force virtual space to be used (for block selections). |
Returns
- TextPosition:
The TextPosition that would found based on the criteria.
GetPositionForLineEnd(TextPosition)
Returns the TextPosition for the end of the view line upon which the specified TextPosition falls.
public TextPosition GetPositionForLineEnd(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The start TextPosition from which to search. |
Returns
- TextPosition:
The TextPosition that would found based on the criteria.
GetPositionForLineStart(TextPosition)
Returns the TextPosition for the start of the view line upon which the specified TextPosition falls.
public TextPosition GetPositionForLineStart(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The start TextPosition from which to search. |
Returns
- TextPosition:
The TextPosition that would found based on the criteria.
GetReader()
Returns an ITextSnapshotReader, initialized at the caret offset, that can be used to navigate through the text and token contents of the current snapshot.
public ITextSnapshotReader GetReader()
Returns
- ITextSnapshotReader:
An ITextBufferReader, initialized at the caret offset, that can be used to navigate through the text and token contents of the current snapshot.
GetTagger<T>(ITextView)
Returns an ITagger<T> for the specified ITextView.
public ITagger<T> GetTagger<T>(ITextView view) where T : ITag
- Type Parameters:
-
T
-The type of ITag created by the tagger.
Parameter | Type | Description |
---|---|---|
view | ITextView | The ITextView that requires an ITagger<T>. |
Returns
- ITagger<T>:
An ITagger<T> for the specified ITextView.
GetTextStatisticsForSelectedText()
Returns the ITextStatistics for the selected text in the view, which provides numerous statistics about the text such as word, sentence, character counts as well as readability scores.
public ITextStatistics GetTextStatisticsForSelectedText()
Returns
- ITextStatistics:
The ITextStatistics for the selected text in the view.
GetViewLine(double, LocationToPositionAlgorithm)
Gets the ITextViewLine that contains the specified Y location.
public ITextViewLine GetViewLine(double verticalLocation, LocationToPositionAlgorithm algorithm)
Parameter | Type | Description |
---|---|---|
verticalLocation | double | The Y location to examine, in text area-relative coordinates. |
algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
- ITextViewLine:
The ITextViewLine that contains the specified Y location.
GetVirtualCharacterFillString(TextPosition, bool)
Gets a string specifying the indentation (tabs and/or spaces) needed to fill a view line up to the specified TextPosition.
public string GetVirtualCharacterFillString(TextPosition position, bool returnCharacterFill)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition to be examined. |
returnCharacterFill | bool | Whether to return a character fill in addition to line fill. |
Returns
- string:
A string specifying the indentation (tabs and/or spaces) needed to fill a view line up to the specified TextPosition.
Remarks
This method will return Empty if the character is not a virtual character.
Indent()
Indents the currently selected lines.
public void Indent()
InsertFile(string)
Inserts the text contents of the specified file into the view, replacing any selected text.
public void InsertFile(string path)
Parameter | Type | Description |
---|---|---|
path | string | The fully qualified path to the file that will be inserted. |
InsertLineBreak()
Inserts a line break into the current selection ranges.
public void InsertLineBreak()
InsertSurroundingText(ITextChangeType, string, string)
Inserts text into the document that surrounds the currently selected text ranges in the view.
public bool InsertSurroundingText(ITextChangeType type, string preText, string postText)
Parameter | Type | Description |
---|---|---|
type | ITextChangeType | An ITextChangeType specifying the type of change. |
preText | string | The text to insert before the currently selected text ranges. |
postText | string | The text to insert after the currently selected text ranges. |
Returns
- bool:
true
if a text change was allowed to occur; otherwise,false
.
InsertSurroundingText(ITextChangeType, string, string, bool)
Inserts text into the document that surrounds the currently selected text ranges in the view.
public bool InsertSurroundingText(ITextChangeType type, string preText, string postText, bool reselect)
Parameter | Type | Description |
---|---|---|
type | ITextChangeType | An ITextChangeType specifying the type of change. |
preText | string | The text to insert before the currently selected text ranges. |
postText | string | The text to insert after the currently selected text ranges. |
reselect | bool | Whether to reselect the inner text. |
Returns
- bool:
true
if a text change was allowed to occur; otherwise,false
.
InsertSurroundingText(string, string)
Inserts text into the document that surrounds the currently selected text ranges in the view, using a TextChangeTypes.TextReplacement
change type.
public bool InsertSurroundingText(string preText, string postText)
Parameter | Type | Description |
---|---|---|
preText | string | The text to insert before the currently selected text ranges. |
postText | string | The text to insert after the currently selected text ranges. |
Returns
- bool:
true
if a text change was allowed to occur; otherwise,false
.
IsVirtualCharacter(TextPosition, bool)
Returns whether the specified TextPosition is a virtual character (beyond line or document end).
public bool IsVirtualCharacter(TextPosition position, bool lineTerminatorsAreVirtual)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition to examine. |
lineTerminatorsAreVirtual | bool | Indicates whether to treat line terminators as virtual characters. |
Returns
- bool:
true
if the specified TextPosition is a virtual character (beyond line or document end); otherwise,false
.
IsVirtualLine(TextPosition)
Returns whether the specified TextPosition is a virtual line (beyond document end).
public bool IsVirtualLine(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition to examine. |
Returns
- bool:
true
if the specified TextPosition is a virtual line (beyond document end); otherwise,false
.
IsVirtualLine(int)
Returns whether the specified TextPosition line index is a virtual line (beyond document end).
public bool IsVirtualLine(int positionLineIndex)
Parameter | Type | Description |
---|---|---|
positionLineIndex | int | The TextPosition line index to examine. |
Returns
- bool:
true
if the specified TextPosition line index is a virtual line (beyond document end); otherwise,false
.
LocationToPosition(Point, LocationToPositionAlgorithm)
Returns the TextPosition for the specified location.
public TextPosition LocationToPosition(Point location, LocationToPositionAlgorithm algorithm)
Parameter | Type | Description |
---|---|---|
location | Point | A |
algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
- TextPosition:
The TextPosition for the specified location.
Remarks
If using an absolute algorithm and no valid TextPosition is located, TextPosition.Empty
will be returned.
MoveSelectedLinesDown()
Moves the selected lines down.
public void MoveSelectedLinesDown()
MoveSelectedLinesUp()
Moves the selected lines up.
public void MoveSelectedLinesUp()
OnApplyTemplate()
Invoked whenever application code or internal processes call ApplyTemplate
.
public override void OnApplyTemplate()
OnCanSplitHorizontallyPropertyChanged(bool, bool)
Occurs when the CanSplitHorizontally property is changed.
protected virtual void OnCanSplitHorizontallyPropertyChanged(bool oldValue, bool newValue)
Parameter | Type | Description |
---|---|---|
oldValue | bool | The old value. |
newValue | bool | The new value. |
OnCreateAutomationPeer()
Returns an AutomationPeer object for this control instance.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
An AutomationPeer instance.
OnGotFocus(RoutedEventArgs)
Occus when the control gains focus.
protected override void OnGotFocus(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | A RoutedEventArgs that contains the event data. |
OnHasFocusChanged(RoutedEventArgs)
Occurs when the HasFocus property value is changed.
protected virtual void OnHasFocusChanged(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | The |
OnHighlightedResultSearchOptionsChanged(RoutedEventArgs)
Occurs when the HighlightedResultSearchOptions property value is changed.
protected virtual void OnHighlightedResultSearchOptionsChanged(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | The |
OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
Reports that the IsKeyboardFocusWithin
property changed.
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | DependencyPropertyChangedEventArgs | The |
OnKeyDown(KeyEventArgs)
Occurs when a key is pressed.
protected override void OnKeyDown(KeyEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyEventArgs | A KeyEventArgs that contains the event data. |
OnKeyUp(KeyEventArgs)
Occurs when a key is released.
protected override void OnKeyUp(KeyEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyEventArgs | A KeyEventArgs that contains the event data. |
OnLostFocus(RoutedEventArgs)
Occus when the control loses focus.
protected override void OnLostFocus(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | A RoutedEventArgs that contains the event data. |
OnRendered()
Occurs when rendering of the view is complete.
protected override void OnRendered()
OnScrollStatePropertyChanged(TextViewScrollState, TextViewScrollState)
Occurs when the ScrollState property is changed.
protected override void OnScrollStatePropertyChanged(TextViewScrollState oldValue, TextViewScrollState newValue)
Parameter | Type | Description |
---|---|---|
oldValue | TextViewScrollState | The old value. |
newValue | TextViewScrollState | The new value. |
OnSelectionChanged(EditorViewSelectionEventArgs)
Occurs after the selection is changed.
protected virtual void OnSelectionChanged(EditorViewSelectionEventArgs e)
Parameter | Type | Description |
---|---|---|
e | EditorViewSelectionEventArgs | The |
OnTextAreaLayout(TextViewTextAreaLayoutEventArgs)
Occurs when the layout of the lines in the text area has been updated.
protected override void OnTextAreaLayout(TextViewTextAreaLayoutEventArgs e)
Parameter | Type | Description |
---|---|---|
e | TextViewTextAreaLayoutEventArgs | The |
OnTextInput(TextCompositionEventArgs)
Occurs when text input is received by the control.
protected override void OnTextInput(TextCompositionEventArgs e)
Parameter | Type | Description |
---|---|---|
e | TextCompositionEventArgs | The |
OnZoomLevelPropertyChanged(double, double)
Occurs when the ZoomLevel property is changed.
protected override void OnZoomLevelPropertyChanged(double oldValue, double newValue)
Parameter | Type | Description |
---|---|---|
oldValue | double | The old value. |
newValue | double | The new value. |
OpenLineAbove()
Inserts a new line above the current selection ranges.
public void OpenLineAbove()
OpenLineBelow()
Inserts a new line below the current selection ranges.
public void OpenLineBelow()
Outdent()
Outdents the currently selected lines.
public void Outdent()
PasteFromClipboard()
Pastes text from the clipboard into the selection.
public void PasteFromClipboard()
PasteFromClipboard(IDataObject)
Pastes text from the specified clipboard IDataObject into the selection.
public void PasteFromClipboard(IDataObject clipboardData)
Parameter | Type | Description |
---|---|---|
clipboardData | IDataObject | An IDataObject containing clipboard data. |
PerformInsertTyping(string)
Simulates the typing of text, using insert mode.
public void PerformInsertTyping(string text)
Parameter | Type | Description |
---|---|---|
text | string | The text that was typed. |
PerformOverwriteTyping(string)
Simulates the typing of text, using overwrite mode.
public void PerformOverwriteTyping(string text)
Parameter | Type | Description |
---|---|---|
text | string | The text that was typed. |
PerformTyping(string)
Simulates the typing of text, using the current overwrite mode setting.
public void PerformTyping(string text)
Parameter | Type | Description |
---|---|---|
text | string | The text that was typed. |
ReplaceAll(IEditorSearchOptions)
Performs a replace all operation.
public ISearchResultSet ReplaceAll(IEditorSearchOptions options)
Parameter | Type | Description |
---|---|---|
options | IEditorSearchOptions | The IEditorSearchOptions to use. |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
ReplaceNext(IEditorSearchOptions)
Performs a replace next operation.
public ISearchResultSet ReplaceNext(IEditorSearchOptions options)
Parameter | Type | Description |
---|---|---|
options | IEditorSearchOptions | The IEditorSearchOptions to use. |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
ReplaceSelectedText(ITextChangeType, string)
Performs a replace text change by overwriting the view's selected text ranges.
public bool ReplaceSelectedText(ITextChangeType type, string text)
Parameter | Type | Description |
---|---|---|
type | ITextChangeType | An ITextChangeType specifying the type of change. |
text | string | The text to insert. |
Returns
- bool:
true
if a text change was allowed to occur; otherwise,false
.
ReplaceSelectedText(ITextChangeType, string, IEditorViewTextChangeOptions)
Performs a replace text change by overwriting the view's selected text ranges.
public bool ReplaceSelectedText(ITextChangeType type, string text, IEditorViewTextChangeOptions options)
Parameter | Type | Description |
---|---|---|
type | ITextChangeType | An ITextChangeType specifying the type of change. |
text | string | The text to insert. |
options | IEditorViewTextChangeOptions | The IEditorViewTextChangeOptions for the change. |
Returns
- bool:
true
if a text change was allowed to occur; otherwise,false
.
RequestAutoComplete()
Performs an auto-complete if the language supports an IntelliPrompt completion session at the current offset.
public void RequestAutoComplete()
RequestCompletionSession()
Displays a completion list if the language supports an IntelliPrompt completion session at the current offset.
public void RequestCompletionSession()
RequestInsertSnippetSession()
Displays IntelliPrompt 'expansion' code snippet selection at the current offset.
public void RequestInsertSnippetSession()
RequestParameterInfoSession()
Displays IntelliPrompt parameter info based on the current context.
public void RequestParameterInfoSession()
RequestQuickInfoSession()
Displays IntelliPrompt quick info based on the current context.
public void RequestQuickInfoSession()
RequestSurroundWithSession()
Displays IntelliPrompt 'surrounds with' code snippet selection at the current offset.
public void RequestSurroundWithSession()
SetSearchStartOffset(IEditorSearchOptions)
Sets the search start offset based on the current selection.
public void SetSearchStartOffset(IEditorSearchOptions options)
Parameter | Type | Description |
---|---|---|
options | IEditorSearchOptions | The IEditorSearchOptions to use. |
StartPointerSelection(InputPointerButtonEventArgs)
Starts a pointer selection operation during a pointer button down event.
public void StartPointerSelection(InputPointerButtonEventArgs e)
Parameter | Type | Description |
---|---|---|
e | InputPointerButtonEventArgs | A InputPointerButtonEventArgs that contains the event data. |
Remarks
The left or right pointer button must be pressed when this method is called. When the left button pointer selection starts, the pointer will be captured and further selection processing will be handled automatically.
TabifySelectedLines()
Converts spaces at the beginning of the active view lines to tabs.
public void TabifySelectedLines()
ToggleCharacterCasing()
Toggles, or inverts, the character casing of the selected text.
public void ToggleCharacterCasing()
Remarks
If no text is currently selected, only the character after the caret is changed.
TransformFromTextArea(Point)
Transforms the specified System.Windows.Point in text area-relative coordinates to view-relative coordinates.
public override Point TransformFromTextArea(Point location)
Parameter | Type | Description |
---|---|---|
location | Point | The System.Windows.Point to transform. |
Returns
- Point:
The transformed System.Windows.Point.
TransformFromTextArea(Rect)
Transforms the specified System.Windows.Rect in text area-relative coordinates to view-relative coordinates.
public override Rect TransformFromTextArea(Rect bounds)
Parameter | Type | Description |
---|---|---|
bounds | Rect | The System.Windows.Rect to transform. |
Returns
- Rect:
The transformed System.Windows.Rect.
TransformToTextArea(Point)
Transforms the specified System.Windows.Point in view-relative coordinates to text area-relative coordinates.
public override Point TransformToTextArea(Point location)
Parameter | Type | Description |
---|---|---|
location | Point | The System.Windows.Point to transform. |
Returns
- Point:
The transformed System.Windows.Point.
TransformToTextArea(Rect)
Transforms the specified System.Windows.Rect in view-relative coordinates to text area-relative coordinates.
public override Rect TransformToTextArea(Rect bounds)
Parameter | Type | Description |
---|---|---|
bounds | Rect | The System.Windows.Rect to transform. |
Returns
- Rect:
The transformed System.Windows.Rect.
TransposeCharacters()
Transposes the characters before and after the caret.
public void TransposeCharacters()
TransposeLines()
Transposes the current line with the next line.
public void TransposeLines()
TransposeWords()
Transposes the current word with the next word.
public void TransposeWords()
TrimAllTrailingWhitespace()
Trims the trailing whitespace off all the lines in the document.
public void TrimAllTrailingWhitespace()
TrimTrailingWhitespace()
Trims the trailing whitespace off all the lines in the selected text, or the current document line if no text is selected.
public void TrimTrailingWhitespace()
UncommentLines()
Uncomments the currently selected lines, using the ILineCommenter specified by the current ISyntaxLanguage.
public void UncommentLines()
UntabifySelectedLines()
Converts tabs at the beginning of the active view lines to spaces.
public void UntabifySelectedLines()
Events
HasFocusChanged
Occurs when the HasFocus property value is changed.
HighlightedResultSearchOptionsChanged
Occurs when the HighlightedResultSearchOptions property value is changed.
SelectionChanged
Occurs after the selection is changed.
public event EventHandler<EditorViewSelectionEventArgs> SelectionChanged
Event Type
Fields
CanSplitHorizontallyProperty
Identifies the CanSplitHorizontally dependency property. This field is read-only.
public static readonly DependencyProperty CanSplitHorizontallyProperty
HasFocusChangedEvent
Identifies the HasFocusChanged routed event. This field is read-only.
public static readonly RoutedEvent HasFocusChangedEvent
HighlightedResultSearchOptionsChangedEvent
Identifies the HighlightedResultSearchOptionsChanged routed event. This field is read-only.
public static readonly RoutedEvent HighlightedResultSearchOptionsChangedEvent
IsActiveProperty
Identifies the IsActive dependency property. This field is read-only.
public static readonly DependencyProperty IsActiveProperty
SelectionChangedEvent
Identifies the SelectionChanged routed event. This field is read-only.
public static readonly RoutedEvent SelectionChangedEvent
Inherited Members
- TextView.ClosedEvent
- TextView.MarginsDestroyedEvent
- TextView.ScrollBarUpdateRequestedEvent
- TextView.TextAreaLayoutEvent
- TextView.ScrollStateProperty
- TextView.ZoomLevelProperty
- TextView.GetViewLine(int)
- TextView.GetViewLine(int, bool)
- TextView.GetViewLine(TextPosition)
- TextView.GetViewLine(ITextViewLine, int)
- TextView.GetViewLine(ITextViewLine, int, bool)
- TextView.InvalidateRender()
- TextView.OffsetToPosition(int)
- TextView.PerformLayout()
- TextView.PositionToOffset(TextPosition)
- TextView.OnClosed(RoutedEventArgs)
- TextView.OnMarginsDestroyed(RoutedEventArgs)
- TextView.OnScrollBarUpdateRequested(RoutedEventArgs)
- TextView.ArePartiallyVisibleViewLinesAllowed
- TextView.CurrentSnapshot
- TextView.DefaultBackgroundColor
- TextView.DefaultCharacterWidth
- TextView.DefaultFontFamilyName
- TextView.DefaultFontSize
- TextView.DefaultFontStyle
- TextView.DefaultFontWeight
- TextView.DefaultForegroundColor
- TextView.DefaultLineHeight
- TextView.DefaultSpaceWidth
- TextView.IsDefaultBackgroundColorLight
- TextView.Properties
- TextView.RenderableTextRange
- TextView.SyntaxEditor
- TextView.UniqueId
- TextView.VisibleViewLines
- TextView.VisualElement
- TextView.WrappedLineIndentAmount
- TextView.ScrollState
- TextView.ZoomLevel
- TextView.Closed
- TextView.MarginsDestroyed
- TextView.ScrollBarUpdateRequested
- TextView.TextAreaLayout