In This Article

IEditorView Interface

Provides the base requirements for a text view that supports editing and is presented in a SyntaxEditor.

public interface IEditorView : ITextView

Properties

ContainsFocus

Gets whether the view currently has or contains keyboard focus.

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.

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.

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.

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.

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.

IntelliPrompt

Gets the IEditorViewIntelliPrompt to use for requesting IntelliPrompt within the view.

IEditorViewIntelliPrompt IntelliPrompt { get; }

Property Value

IEditorViewIntelliPrompt:

The IEditorViewIntelliPrompt to use for requesting IntelliPrompt within the view.

IsActive

Gets whether the view is the currently-active view in the editor.

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. Use the HasFocus property to determine if the view currently has keyboard focus.

IsIncrementalSearchActive

Gets or sets whether incremental searching is active.

bool IsIncrementalSearchActive { get; set; }

Property Value

bool:

true if incremental searching is active; otherwise, false.

Margins

Gets the collection of margins that are currently in the view.

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.

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.

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.

ITextPositionFinder PositionFinder { get; }

Property Value

ITextPositionFinder:

The ITextPositionFinder instance.

Scroller

Gets the IEditorViewScroller to use for scrolling the view.

IEditorViewScroller Scroller { get; }

Property Value

IEditorViewScroller:

The IEditorViewScroller to use for scrolling the view.

Searcher

Gets the IEditorViewSearcher that is used to perform find/replace and other search-related operations on the view.

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.

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.

IEditorViewSelection Selection { get; }

Property Value

IEditorViewSelection:

An IEditorViewSelection that manages the selection within the view.

TextChangeActions

Gets the IEditorViewTextChangeActions that is used to perform text change actions in the view.

IEditorViewTextChangeActions TextChangeActions { get; }

Property Value

IEditorViewTextChangeActions:

The IEditorViewTextChangeActions that is used to perform text change actions in the view.

Methods

Activate()

Activates this view.

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.

CopyAndAppendToClipboard()

Copies the currently selected text and appends it to the existing text on the clipboard.

void CopyAndAppendToClipboard()

CopyToClipboard()

Copies the currently selected text to the clipboard.

void CopyToClipboard()

CutAndAppendToClipboard()

Cuts the currently selected text and appends it to the existing text on the clipboard.

void CutAndAppendToClipboard()

CutLineToClipboard()

Cuts the currently active view line to the clipboard.

void CutLineToClipboard()

CutToClipboard()

Cuts the currently selected text to the clipboard.

void CutToClipboard()

DeleteSelectedText(ITextChangeType)

Performs a delete text change by deleting the view's selected text ranges.

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.

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.

ExecuteEditAction(IEditAction)

Executes the specified IEditAction within the view and records the action within a macro when appropriate.

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.

string ExportSelectedText(ITextExporter exporter)
Parameter Type Description
exporter ITextExporter

The ITextExporter to use for the export operation.

Returns

string:

The exported text.

FindCurrentWordEnd()

Returns the document offset of the word end character that occurs at or after the primary caret.

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.

int FindCurrentWordStart()

Returns

int:

The document offset of the word start character that occurs at or before the primary caret.

FindNextWordStart()

Returns the document offset of the word start character that occurs after the primary caret.

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.

int FindPreviousWordStart()

Returns

int:

The document offset of the word start character that occurs before the primary caret.

Focus()

Ensures the view has focus.

bool Focus()

Returns

bool:

true if focus was successfully set; otherwise, false.

Focus(FocusState)

Ensures the view has focus.

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; otherwise, false.

GetCharacterBounds(TextPosition)

Returns the TextBounds for the specified TextPosition, relative to the text area's coordinates.

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.

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.

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.

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.

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.

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.

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.

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.
For continuous stream selections, pass 1.

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.

string GetCurrentWordText()

Returns

string:

The text of the current word.

GetCurrentWordTextRange()

Gets the TextRange for the current word.

TextRange GetCurrentWordTextRange()

Returns

TextRange:

A TextRange containing the offset range for the current word.

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.

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.

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.

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.

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.

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.

InsertFile(string)

Inserts the text contents of the specified file into the view, replacing any selected text.

void InsertFile(string path)
Parameter Type Description
path string

The fully qualified path to the file that will be inserted.

InsertSurroundingText(ITextChangeType, string, string)

Inserts text into the document that surrounds the currently selected text ranges in the view.

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.

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.

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).

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).

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).

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.

TextPosition LocationToPosition(Point location, LocationToPositionAlgorithm algorithm)
Parameter Type Description
location Point

A Point specifying a location in text area-relative coordinates.

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.

PasteFromClipboard()

Pastes text from the clipboard into the selection.

void PasteFromClipboard()

ReplaceSelectedText(ITextChangeType, string)

Performs a replace text change by overwriting the view's selected text ranges.

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.

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.

StartPointerSelection(InputPointerButtonEventArgs)

Starts a pointer selection operation during a pointer button down event.

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.

Events

HasFocusChanged

Occurs when the HasFocus property value is changed.

event EventHandler HasFocusChanged

Event Type

EventHandler

HighlightedResultSearchOptionsChanged

Occurs when the HighlightedResultSearchOptions property value is changed.

event EventHandler HighlightedResultSearchOptionsChanged

Event Type

EventHandler

SelectionChanged

Occurs after the selection is changed.

event EventHandler<EditorViewSelectionEventArgs> SelectionChanged

Event Type

EventHandler<EditorViewSelectionEventArgs>

Inherited Members